SLURM Submit multiple tasks per node?

你说的曾经没有我的故事 提交于 2019-12-05 11:16:00

Your setup is correct except that you must use the --exclusive option of srun (which has a different meaning in this case than for sbatch).

As for your remark regarding the usefulness of srun, the behaviour of the program can be changed based on the environment variable $SLURM_TASK_ID, or the rank in case of an MPI program. Your confusion arises from the fact that your program is not written to be parallel (appart from the 2 OMP threads) while srun is meant to start parallel programs, most of the time based on MPI.

An other way is to run all your tasks at once. since the input and output file depends on the rank, a wrapper is needed

your SLURM script would be

#SBATCH --nodes=3
#SBATCH --ntasks=36
#SBATCH --cpus-per-task=2
#SBATCH --mem-per-cpu=2000

export OMP_NUM_THREADS=2

srun -n 36 ./program.sh

and your wrapper program.sh would be

#!/bin/sh

exec ./program input${SLURM_PROCID} > out${SLURM_PROCID} 2>&1 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!