[slurm-users] Automatically setting OMP_NUM_THREADS=SLURM_CPUS_PER_TASK?
Bjørn-Helge Mevik
b.h.mevik at usit.uio.no
Wed Mar 7 01:18:47 MST 2018
We have the following code in our TaskProlog:
## Set $OMP_NUM_THREADS unless it was set when calling sbatch or in the job script:
if [[ -z $OMP_NUM_THREADS ]]; then
if [[ -n $SLURM_CPUS_PER_TASK ]]; then
echo export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
else
echo export OMP_NUM_THREADS=1
fi
fi
It sets OMP_NUM_THREADS to SLURM_CPUS_PER_TASK (or 1 if --cpus-per-task
is not specified), unless already set. That way, users can override it
in their job script if they wish. It seems to work fine.
--
Regards,
Bjørn-Helge Mevik, dr. scient,
Department for Research Computing, University of Oslo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20180307/3566ec48/attachment.sig>
More information about the slurm-users
mailing list