Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Provides links to environment variables used in the OpenMP API.
The Visual C++ implementation of the OpenMP standard includes the following environment variables. These environment variables are read at program startup and modifications to their values are ignored at runtime (for example, using _putenv, _wputenv).
Environment variable | Description |
---|---|
OMP_SCHEDULE | Modifies the behavior of the schedule clause when schedule(runtime) is specified in a for or parallel for directive. |
OMP_NUM_THREADS | Sets the maximum number of threads in the parallel region, unless overridden by omp_set_num_threads or num_threads. |
OMP_DYNAMIC | Specifies whether the OpenMP run time can adjust the number of threads in a parallel region. |
OMP_NESTED | Specifies whether nested parallelism is enabled, unless nested parallelism is enabled or disabled with omp_set_nested . |
OMP_DYNAMIC
Specifies whether the OpenMP run time can adjust the number of threads in a parallel region.
set OMP_DYNAMIC[=TRUE | =FALSE]
Remarks
The OMP_DYNAMIC
environment variable can be overridden by the omp_set_dynamic function.
The default value in the Visual C++ implementation of the OpenMP standard is OMP_DYNAMIC=FALSE
.
For more information, see 4.3 OMP_DYNAMIC.
Example
The following command sets the OMP_DYNAMIC
environment variable to TRUE:
set OMP_DYNAMIC=TRUE
The following command displays the current setting of the OMP_DYNAMIC
environment variable:
set OMP_DYNAMIC
OMP_NESTED
Specifies whether nested parallelism is enabled, unless nested parallelism is enabled or disabled with omp_set_nested
.
set OMP_NESTED[=TRUE | =FALSE]
Remarks
The OMP_NESTED
environment variable can be overridden by the omp_set_nested function.
The default value in the Visual C++ implementation of the OpenMP standard is OMP_NESTED=FALSE
.
For more information, see 4.4 OMP_NESTED.
Example
The following command sets the OMP_NESTED
environment variable to TRUE:
set OMP_NESTED=TRUE
The following command displays the current setting of the OMP_NESTED
environment variable:
set OMP_NESTED
OMP_NUM_THREADS
Sets the maximum number of threads in the parallel region, unless overridden by omp_set_num_threads or num_threads.
set OMP_NUM_THREADS[=num]
Parameters
num
The maximum number of threads you want in the parallel region, up to 64 in the Visual C++ implementation.
Remarks
The OMP_NUM_THREADS
environment variable can be overridden by the omp_set_num_threads function or by num_threads.
The default value of num
in the Visual C++ implementation of the OpenMP standard is the number of virtual processors, including hyperthreading CPUs.
For more information, see 4.2 OMP_NUM_THREADS.
Example
The following command sets the OMP_NUM_THREADS
environment variable to 16
:
set OMP_NUM_THREADS=16
The following command displays the current setting of the OMP_NUM_THREADS
environment variable:
set OMP_NUM_THREADS
OMP_SCHEDULE
Modifies the behavior of the schedule clause when schedule(runtime)
is specified in a for
or parallel for
directive.
set OMP_SCHEDULE[=type[,size]]
Parameters
size
(Optional) Specifies the size of iterations. size must be a positive integer. The default is 1
, except when type is static. Not valid when type is runtime
.
type
The kind of scheduling, either dynamic
, guided
, runtime
, or static
.
Remarks
The default value in the Visual C++ implementation of the OpenMP standard is OMP_SCHEDULE=static,0
.
For more information, see 4.1 OMP_SCHEDULE.
Example
The following command sets the OMP_SCHEDULE
environment variable:
set OMP_SCHEDULE="guided,2"
The following command displays the current setting of the OMP_SCHEDULE
environment variable:
set OMP_SCHEDULE