Hprc banner tamu.png

IBM:XLCompile:OpenMP

From TAMU HPRC
Revision as of 17:34, 23 October 2015 by J-perdue (talk | contribs) (Compiling OpenMP code)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

OpenMP Programs

Compiling OpenMP code

To compile programs containing OpenMP parallel directives/pragmas the following flag needs to be used

openmp flags:

Flag Description
-qsmp=omp Enables strict OpenMP compliance. Only OpenMP parallelization directives are recognized.

NOTE: when compiling OpenMP programs the appropriate compiler with the "_r" extension needs to be used otherwise the program will not work and most likely crash.

Example: compile OpenMP program hello_omp.c and name if hello_omp.x

xlc_r -qsmp=omp -o hello_omp.x hello_omp.c

Running OpenMP Code

OpenMP programs can be run exactly the same as serial programs. Use OpenMP environment variables to control the OpenMP behavior

Example: run the program hello_omp.x and set the number of threads to 8

export OMP_NUM_THREADS=8
./hello_omp.x