OpenMP Run-time Options for Parallel Processing (C Only)

OpenMP run-time time options affecting parallel processing are specified in a set of OMP environment variables. These environment variables, which must be set before you run an application, use syntax of form:

env_variable=option_and_args

Parallelization run-time options can also be specified by the XLSMPOPTS environment variable. When OMP and XLSMPOPTS run-time options conflict, OMP options will prevail.

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 specified, the value of n must be an integer value of 1 or greater.

The default is scheduling algorithm is static.

See #pragma omp for Preprocessor Directive for a description of these algorithms.

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.

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. See the description for profilefreq=num in IBM Run-time Options for Parallel Processing for more information.

If set to FALSE, dynamic adjustment is disabled.

The default setting is TRUE.

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


Program Parallelization
Shared and Private Variables in a Parallel Environment
Compiler Modes


Invoke the Batch Compiler


#pragma Preprocessor Directives for Parallel Processing
IBM Run-time Options for Parallel Processing
#pragma ibm schedule Preprocessor Directive
Built-in Functions Used for Parallel Processing
-qsmp