SET_OMP Procedure
Sets the run-time OpenMP parameters for shared-memory, multi-processor machines running supported operating systems.
Usage
SET_OMP
Input Parameters
None.
Keywords
Dynamic—Toggles the use of dynamic threading. Dynamic=1 turns it on, Dynamic=0 turns it off. See the Discussion section for a more complete discussion of Dynamic. Default is off.
Info—Displays information about the current OpenMP settings.
Nthreads—Sets the maximum number of threads allowed. Default is the number of available processors.
Threshold—Sets the threshold number of array elements above which OpenMP parallelization occurs. Default is 1000.
File—Name of a file that supplies threading parameters optimized for the machine running PV-WAVE. This file can be generated by running
OMPTUNE, and it allows PV-WAVE to automatically vary the number of threads so that it is optimal for any given operation.
Nthreads can still set a maximum number of threads, but it must be set before
File is set or at the same time that
File is set. When
File is set,
Threshold is automatically adjusted, but can be overridden after
File is set. The default is 'no file', but without a machine-specific tuning file, parallel-performance will be far from optimal, especially on machines with many processors. It is recommended that
File be set at the beginning of the PV-WAVE session, most conveniently in a startup file.
Auto—Toggles the automatic thread control initiated with the File keyword. If File is not set then Auto is 0 (off), but when File is set then Auto is automatically set to 1 (on). To disable automatic thread control and to restore the OpenMP runtime defaults, use the command:
SET_OMP, Auto=0, Dynamic=0, Threshold=1000, Nthreads=!nprocs
Discussion
For supported operating systems, PV-WAVE uses the OpenMP API to employ loop-level parallelization on shared-memory, multi-processor machines for most array operations. For a complete list of the operations and a discussion of OpenMP and PV-WAVE, please see the PV‑WAVE Programmer’s Guide.
The OpenMP Dynamic mode tries to equitably share resources among processes, but the current implementation of Dynamic seriously impedes performance for a single cpu-intensive process by depriving it of too many threads, wasting them on extremely light-weight processes (such as from the OS or from a LAN). Dynamic mode can be convenient for machines which are expected to handle arbitrarily many simultaneous cpu-intensive processes; just set Dynamic=1 regardless of other OpenMP settings that may be in effect.
For a machine expected to handle n simultaneous cpu-intensive processes, alternatives to Dynamic would be:
SET_OMP, Nthreads=!nprocs/n
or for automatic thread control:
SET_OMP, File='tunefile', Nthreads=!nprocs/n
SET_OMP is often most appropriately and conveniently used in a PV-WAVE startup file which is executed at the beginning of each PV-WAVE session. Any defaults set in a startup file can always be overridden at the prompt or within PV-WAVE code.
Example
Turn dynamic threading off:
SET_OMP, Dynamic=0
Set threshold to 1000 elements and display settings:
SET_OMP, Threshold=1000, /Info
Set maximum number of threads to 4 and display:
SET_OMP, Nthreads=4, /Info
See Also