How do I run OpenMP programs on an HPCVL machine?

Please note: The FAQ pages at the HPCVL website are continuously being revised. Some pages might pertain to an older configuration of the system. Please let us know if you encounter problems or inaccuracies, and we will correct the entries.

Unlike MPI programs, shared-memory parallel OpenMP programs do not need a special runtime environment to run in parallel. They only need to be instructed about the number of threads (or processes) that should be used. This is usually done by setting an environment variable. The default variable used on any system that is OpenMP enabled is OMP_NUM_THREADS. For instance, in a bash, the following sequence will cause the OpenMP program test_omp.exe to be executed with 16 threads:

export OMP_NUM_THREADS=16; test_omp.exe

Incidentally, the number of threads may also be set from inside the program by means of a function call. The line

call omp_set_num_threads(16)

inside the program test_omp.f90 will have the same effect as setting the environment variable. This will take precedent over external settings.