Open Multi-Processing (OpenMP) is a programming interface designed for taking advantage of more than one processor (or core) in a single node. OpenMP consists of a collection of compiler directives. All compiler suites available on Palmetto support OpenMP standard.
The simple “Hello world” program can be augmented with OpenMP directives to allow multiprocessing
To enable the OpenMP directives one has to tell the compiler to do so using a compiler specific
command line option. The file above
hello_omp.c can be compiled on Palmetto using the following
The number of threads used in the program compiled with OpenMP directives is controlled using
the environmental variable
OMP_NUM_THREADS. The value of
OMP_NUM_THREADS is automatically set
to the number of requested processors per node. For example
$ qsub -I -l select=1:ncpus=8 ... $ module load intel/13.0 $ icc -openmp hello_omp.c -o hello.x $ export OMP_NUM_THREADS=8 $ ./hello.x
hello.x will create 8 threads.