- How to allocate resources?
Suppose you need 16 cores. Here are some use cases:
- you use mpi and do not care about where those cores are distributed: --ntasks=16
- you want to launch 16 independent processes (no communication): --ntasks=16
- you want those cores to spread across distinct nodes: --ntasks=16 and --ntasks-per-node=1 or --ntasks=16 and --nodes=16
- you want those cores to spread across distinct nodes and no interference from other jobs:--ntasks=16 --nodes=16 --exclusive
- you want 16 processes to spread across 8 nodes to have two processes per node: --ntasks=16 --ntasks-per-node=2
- you want 16 processes to stay on the same node: --ntasks=16 --ntasks-per-node=16
- you want one process that can use 16 cores for multithreadingi: --ntasks=1 --cpus-per-task=16
- you want 4 processes that can use 4 cores each for multithreading:--ntasks=4 --cpus-per-task=4 ref: http://www.ceci-hpc.be/slurm_faq.html#Q05
- To specify that only a certain number of sub-jobs in the array can run at a time, use the percent sign (%) delimiter. In this example, only five sub-jobs in the array can run at a time.
$ sbatch --array [1-1000]%5 testarray.sh
To submit a specific set of array sub-jobs, use the comma delimiter in the array index list.
$ sbatch --array [1,2,3,4] testarray.sh
$ sbatch --array [1-5,7,10] testarray.sh
To submit a job with a step size, use a colon (:) in the array range and specify how many jobs to step. In the example below, a step size of 2 is requested. The sub-jobs will be numbered according to the step size inside the index limit.
$ sbatch --array [2-10:2] testarray.sh