Home

ntasks

Ntasks is a parameter used in parallel computing to specify the number of tasks (often MPI processes) to be launched for a job. It is commonly exposed by batch schedulers and MPI runtimes to control the scale of a parallel execution.

In Slurm, the option --ntasks (short -n) requests that a total of N tasks be started across

Ntasks is conceptually distinct from the number of CPUs or cores allocated. For example, you might allocate

Notes: In MPI environments, ntasks often correspond to MPI ranks; in other setups it may refer to

the
allocated
nodes.
This
typically
maps
to
MPI
ranks
or
other
worker
units
used
by
the
application.
The
value
interacts
with
other
resource
specifications
such
as
--nodes,
--cpus-per-task,
and,
in
some
configurations,
--ntasks-per-node,
which
caps
the
number
of
tasks
that
can
run
on
each
node.
An
example:
sbatch
--ntasks=64
myjob.sh
or
srun
-n
64
./my_program.
several
nodes
with
a
given
number
of
CPUs
per
task
and
set
--ntasks=32,
depending
on
the
launcher,
to
achieve
a
desired
level
of
parallelism.
The
actual
mapping
from
tasks
to
hardware
depends
on
the
scheduler
and
runtime
being
used.
independent
worker
processes.
The
term
is
used
across
batch
systems
such
as
Slurm,
Torque/PBS,
and
others,
sometimes
with
different
command-line
flags
but
preserving
the
same
general
meaning.