The srun
command will start as many instances of the command as specified with the --ntasks
parameter. It is typically used with MPI programs and programs that run embarrassingly parallel workloads.
A command like srun cp ...
only makes sense in the case multiple nodes are requested and only one task is running per node, so with for instance --nodes=N
or --ntasks=N --ntasks-per-node=1
or a similar combination. It can be used to copy files from a network filesystem to a local filesystem.
If there is only one node and multiple tasks, the srun
could cause problems by concurrently trying to write to the same file.
If there is only one task, then the srun
are not really needed (except if you want to use sstat
to monitor them).
In any case, consecutive srun
's are run on the same sets of nodes without cleaning.