Parallelism
Making a computation use many cores and nodes, by the kind of parallel it is: threads, many independent tasks, ranks that communicate, and workflows.
This part is about making a computation that takes too long on one core use many: first working out which kind of parallel it is, then threads in one process, many independent tasks on one node with GNU parallel or a pool of processes, job arrays across nodes, Python tasks spread over nodes with mpi4py.futures and DragonHPC, MPI with threads in each rank, and workflows of tasks that depend on each other. Every page solves the same problem, a Monte Carlo estimate of π, so that the ways compare.
| Title | Description |
|---|---|
| Which kind of parallel is yours? | From a computation that takes too long on one core to the kind of parallelism it needs: many independent tasks, threads in one process, ranks that communicate, or tasks that depend on each other, on one node or many, and the Monte Carlo π example every page of this part solves. |
| Which way to run many tasks? | Many independent tasks, each its own process, and the ways to run them side by side: GNU parallel and a pool of processes in Python on one node, a job array, mpi4py.futures and DragonHPC over many; what the tasks can be, what each needs, how a failed task shows and is rerun, the load on the scheduler, and which to reach for first. |
| Threads and oversubscription | One process using many cores through threads, from OpenMP, BLAS, NumPy or Numba; asking Slurm for the cores with –cpus-per-task; and oversubscription, more threads than cores, with the environment variables that prevent it and how to see it. |
| Many independent tasks | Many tasks that need nothing from each other, run as many at a time as there are cores: on one node with GNU parallel or a pool of processes in Python, and over many nodes with job arrays, mpi4py.futures and DragonHPC. |
| Hybrid MPI: ranks with threads | One MPI program with threads in each rank (MPI+X): sizing –ntasks-per-node and –cpus-per-task, NUMA domains, pinning ranks with srun –cpu-bind and their threads with OMP_PLACES and OMP_PROC_BIND, and checking where every rank and thread really runs, on Monte Carlo π as mpi4py ranks with a pool of threads each. |
| Workflow managers | Tasks that depend on each other: from a chain of sbatch –dependency to a workflow manager (make, Snakemake, Nextflow, Parsl), on Monte Carlo π as a Snakefile, and the questions specific to a cluster: one Slurm job per task or everything in one allocation, where the manager’s head process runs, throttling its submissions, a working directory on a filesystem with locking, and software for every step. |
No matching items