Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To execute this script, the command to be issued is

sbatch

...

<executable.sh>

Code Block
bash-4.2$ sbatch test_slurm.sh
Submitted batch job 8501

...

Code Block
bash-4.2$ sstat --format=JobID,AveCPU -j 8501
JobID            AveCPU 
------------ ---------- 
8501.0       213503982+ 

The option "--format" allows to customise the output based on the desired features.

...

Code Block
-bash-4.2$ cat tasks1.txt
hpc-200-06-17
hpc-200-06-17
hpc-200-06-17
hpc-200-06-17
hpc-200-06-17
[...]

As we can see, the --ntasks-per-node=8 option was interpreted by slurm as “reserve 8 cpus on node 17 and 8 on node 18 and execute the job on those cpus”.
It is quite useful to see how the output would look in case of --ntasks=8 was used instead of --ntasks-per-cpu. In that case, the output should be exactly:

...

N.B: before compiling the file, you need to load the proper module as shown above. You can find the available modules by running module avail.  Finally, it is possible to see the list of the loaded modules with:

...

On way of acting might be to secure copy the executable over the desired nodelist, which can be feasible only if 1-2 nodes are involved. Otherwise, Slurm offers a srun option which may help the user. 

...

Code Block
srun --bcast=~/picalc.mpi picalc.mpi

Where the --bcast option copies the executable to every node by specifying the destination path. In this case, we decided to copy the executable into the home folder keeping the original name as-is.

...

It must be specified the number of GPUs needed for the job with the option --gres=gpu:<n_of_GPUs>.

It is not mandatory to specify the partition where to submit the job as SLURM will find the nodes with GPUs.

...

Again, if secure-copying the executable over every node involved in our computation is an un-optimized operation, the user should add the --bcast option to the srun command.

...