| OPENMP API Specification: Version 5.0 November 2018


The OMP_NUM_THREADS environment variable sets the number of threads to use for parallel regions by setting the initial value of the nthreads-var ICV. See Section 2.5 on page 171 for a comprehensive set of rules about the interaction between the OMP_NUM_THREADS environment variable, the num_threads clause, the omp_set_num_threads library routine and dynamic adjustment of threads, and Section 2.6.1 on page 224 for a complete algorithm that describes how the number of threads for a parallel region is determined.

The value of this environment variable must be a list of positive integer values. The values of the list set the number of threads to use for parallel regions at the corresponding nested levels.

The behavior of the program is implementation defined if any value of the list specified in the OMP_NUM_THREADS environment variable leads to a number of threads that is greater than an implementation can support, or if any value is not a positive integer.


setenv OMP_NUM_THREADS 4,3,2  

Cross References