[slurm-users] ntasks and cpus-per-task

Christopher Samuel chris at csamuel.org
Thu Feb 22 01:15:48 MST 2018


On 22/02/18 18:49, Miguel Gutiérrez Páez wrote:

> What's the real meaning of ntasks? Has cpus-per-task and ntasks the
> same meaning in sbatch and srun?

--ntasks is for parallel distributed jobs, where you can run lots of
independent processes that collaborate using some form of communication
between the processes (usually MPI for HPC).

So inside your batch script you would use "srun" to start up the tasks.

However, unless you code is written to make use of that interface then
it's not really going to help you, and so for any multithreaded
application you need to use --cpus-per-task instead.

Now, you can get fancy and have hybrid applications which can be split
up across nodes (individual processes) but each one of those tasks can
also use multiple cores at the same time by multi-threading.

Of course if your application isn't multithreaded in the first place
then you only need to ask for 1 task and 1 core for it anyway! :-)

Best of luck,
Chris



More information about the slurm-users mailing list