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.4 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 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.
The OMP_NUM_THREADS environment variable sets the max-active-levels-var ICV to the number of active levels of parallelism that the implementation supports if the OMP_NUM_THREADS environment variable is set to a comma-separated list of more than one value. The value of the max-active-level-var ICV may be overridden by setting OMP_MAX_ACTIVE_LEVELS or OMP_NESTED. See Section 6.8 and Section 6.9 for details.
setenv OMP_NUM_THREADS 4,3,2