How do I submit an MPI/OpenMP job in a slurm cluster? Are there any tricks to ensure that processors and memory get assigned the way that I am intending?
You should supply the following options to sbatch (typically, as shown here
as part of the job script):
#!/bin/sh
#SBATCH --cpus-per-task=4
#SBATCH --ntasks=6
...
The “–cpus-per-task=4” can be be abbreviated “-c 4” and the “–ntasks=6” can
be abbreviated “-n 6”.
The specifies that you wish to run 6 MPI “tasks”, with each task getting 4
CPU cores. This way every OpenMP thread will get its own CPU core. It will
also ensure that all four cores for each MPI task are allocated on the same node
(e.g. you won’t get 10 cores on each of 2 nodes and 4 cores on a third node).
You will need to add other sbatch options (walltime, memory, etc) as usual.