4.2 OMP_NUM_THREADS

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The OMP_NUM_THREADS environment variable sets the default number of threads to use during execution, unless that number is explicitly changed by calling the omp_set_num_threads library routine or by an explicit num_threads clause on a parallel directive.

The value of the OMP_NUM_THREADS environment variable must be a positive integer. Its effect depends upon whether dynamic adjustment of the number of threads is enabled. For a comprehensive set of rules about the interaction between the OMP_NUM_THREADS environment variable and dynamic adjustment of threads, see Section 2.3 on page 8.

If no value is specified for the OMP_NUM_THREADS environment variable, or if the value specified is not a positive integer, or if the value is greater than the maximum number of threads the system can support, the number of threads to use is implementation-defined.

Example:

setenv OMP_NUM_THREADS 16  

Cross References: