Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Submitting an OpenMP job is different from Submitting an MPI Job since you must request multiple cores from a single node.

Code Block
languagebash
titleOpenMP example submission
#!/bin/sh
#SBATCH --ntasks-per-node=16     # 16 cores
#SBATCH --nodes=1                # 1 node
#SBATCH --mem-per-cpu=1024       # Minimum memory required per CPU (in megabytes)
#SBATCH --time=03:15:00          # Run time in hh:mm:ss
#SBATCH --error=/work/[groupname]/[username]/job.%J.err
#SBATCH --output=/work/[groupname]/[username]/job.%J.out
 
export OMP_NUM_THREADS=16
./openmp-app.exe 

Notice that we used ntasks-per-node to specify the number of cores we want on a single node.  Additionally, we specify that we only want 1 node.  

OMP_NUM_THREADS is required to limit the number of cores that OpenMP will use on the node.  It should match the ntasks-per-node value.

Compiling

Directions to compile OpenMP can be found on Compiling an OpenMP Application.  

Further Documentation

Further OpenMP documentation can be found on LLNL's OpenMP website.