NERSCPowering Scientific Discovery Since 1974

Using OpenMP


Adding OpenMP threading to an MPI code is an efficient way to run on multicore processors. Since OpenMP uses a global shared address space within each node, using OpenMP may reduce memory usage while adding parallelism. It can also reduce time spent in MPI communications.  A collection of OpenMP resources, tutorials, etc can be found at OpenMP Reources.  An interesting advantage of OpenMP is that you can add it incrementally to an existing code.

Compiling to use OpenMP

OpenMP is supported in all three programming environments available on Edison; however, each compiler suite has a different syntax for enabling OpenMP.

Compiler SuiteProgramming Environment module nameCommand line option for OpenMP
Cray Compilers PrgEnv-cray none needed; OpenMP is the default
Intel Compilers PrgEnv-intel -openmp
GNU Compilers PrgEnv-gnu -fopenmp

Running with OpenMP 

Please refer to Using OpenMP with MPI for more information and sample batch scripts for Edison.