Running OpenMP Jobs

OpenMP or threaded applications

To run an OpenMP job or threaded application one must include parameters on the srun command. Since srun launches a process per core allocated, for these type of jobs you only want to launch a single process and allow the threads to use all the allocated cores.

The following script will run an OpenMP job that uses 12 threads for four hours:

#SBATCH --job-name=multicore     # create a short name for your job
#SBATCH --nodes=1                # node count
#SBATCH --ntasks=12              # total number of tasks across all nodes
#SBATCH --cpus-per-task=1        # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G         # memory per cpu-core (4G per cpu-core is default)
#SBATCH --time=04:00:00          # maximum time needed (HH:MM:SS)
#SBATCH --mail-type=all          # send email on job start, end and fail

srun -n 1 --cpu-bind=none a.out

Alternatively, simply DON'T use srun at all for serial or multithreaded jobs, just replace the srun command by the following: