set_num_threads sets the number of threads requested for subsequent OpenMP parallel regions.

For full information please refer to the NAG Library document for x06aa

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/x06/x06aaf.html

Parameters
numint

The number of threads requested for subsequent OpenMP parallel regions.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

Notes

set_num_threads, for multithreaded implementations, sets the number of threads to be requested for subsequent parallel regions to . The first element of the list held by the OpenMP Internal Control Variable (ICV) used in determining the number of threads is set.

The number of threads used in parallel regions will be equal to, or less than, the value of the ICV. The actual number of threads used is dependent on several factors, such as the presence of a num_threads clause on the parallel directive or the number of threads already in use by the program. Please refer to References for a full description of how the number of threads is chosen for a particular parallel region.

In serial implementations of the NAG Library this function has no effect. See the X06 Introduction for a discussion of the behaviour of these functions when called in serial.

References

The OpenMP API Specification for Parallel Programming

Chapman, B, Jost, G and van der Pas, R, 2008, Using OpenMP Portable Shared Memory Parallel Programming, The MIT Press