Share via


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]

Remarks

where,

  • 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

See Also

Reference

OpenMP Environment Variables