NOTE: Most users will not need to go through this step as OpenMP support will be enabled when using the packaged installation script as described on this page: Building the Flow Solver
Enabling OpenMP Support
For shared memory architectures where the MPI message-passing library is not available, an OpenMP executable can be employed.
In order to compile for OpenMP, the MPI variable should be set to:
MPI = MPI_OFF
in the make file. This has the effect of removing all MPI library calls in the source code. The appropriate compilation flags for OpenMP parallelization are then required in the FFLAGS variable for the fortran compiler. Usually, this is achieved using the -mp compilation flag, along with any other desired optimization flags.
MPITHREAD = MPITHREAD_OFF
should be used in all cases.
Once the code has been compiled, the number of processes can be specified at run-time using the NTHREAD variable in the input file. NTHREAD denotes the number of OpenMP threads to be used during parallel execution. On some systems it may also be necessary to set the OMP_NUM_THREADS environment variable to enable the requested number of threads to be employed.
If for such a reason NTHREAD threads cannot be spawned, nsu3d will terminate with a message to that effect. The number of threads should not exceed the number of partitions of the partitioned grid file. Although any number of threads can be specified at runtime, a larger number of threads will result in idle threads. A smaller number of threads will results in more than one partition being processed on each cpu.
For efficient execution, the number of partitions should thus be a multiple of the number of threads/processors employed. Thus a 32 way grid partition can be run efficiently on 1, 2, 4, 16, or 32 threads/processors.
OpenMP executables are run in the same manner as any other executables, by simply invoking the executable name along with the name of the input file: