OpenMP Run-time Options for Parallel Processing

OpenMP run-time time options affecting parallel processing are set by specifying OMP environment variables. These environment variables, use syntax of the form:


Syntax Diagram

If an OMP environment variable is not explicitly set, its default setting is used.

Note:
You must use thread-safe compiler mode invocations when compiling parallelized program code.

OpenMP run-time options fall into different categories as described below:

Scheduling Algorithm Environment Variable


OMP_SCHEDULE=algorithm This option specifies the scheduling algorithm used for loops not explictly assigned a scheduling alogorithm with the omp schedule directive. For example:
OMP_SCHEDULE="guided, 4"

Valid options for algorithm are:

  • dynamic[, n]
  • guided[, n]
  • runtime
  • static[, n]

If specifying a chunk size with n, the value of n must be an integer value of 1 or greater.

The default scheduling algorithm is static.

Parallel Environment Environment Variables


OMP_NUM_THREADS=num num represents the number of parallel threads requested, which is usually equivalent to the number of processors available on the system.

This number can be overridden during program execution by calling the omp_set_num_threads( ) runtime library function.

Some applications cannot use more threads than the maximum number of processors available. Other applications can experience significant performance improvements if they use more threads than there are processors. This option gives you full control over the number of user threads used to run your program.

The default value for num is the number of processors available on the system.

You can override the setting of OMP_NUM_THREADS for a given parallel section by using the num_threads clause available in several #pragma omp directives.

OMP_NESTED=TRUE|FALSE This environment variable enables or disables nested parallelism. The setting of this environment variable can be overrridden by calling the omp_set_nested( ) runtime library function.

If nested parallelism is disabled, nested parallel regions are serialized and run in the current thread.

In the current implementation, nested parallel regions are always serialized. As a result, OMP_SET_NESTED does not have any effect, and omp_get_nested() always returns 0. If -qsmp=nested_par option is on (only in non-strict OMP mode), nested parallel regions may employ additional threads as available. However, no new team will be created to run nested parallel regions.

The default value for OMP_NESTED is FALSE.

Dynamic Profiling Environment Variable


OMP_DYNAMIC=TRUE|FALSE This environment variable enables or disables dynamic adjustment of the number of threads available for running parallel regions.

If set to TRUE, the number of threads available for executing parallel regions may be adjusted at runtime to make the best use of system resources.

If set to FALSE, dynamic adjustment is disabled.

The default setting is TRUE.

Related Concepts

Program Parallelization
OpenMP Directives

Related References

Pragmas to Control Parallel Processing
Built-in Functions Used for Parallel Processing

For complete information about the OpenMP Specification, see:

IBM Copyright 2003