naginterfaces.library.omp.get_​num_​threads

naginterfaces.library.omp.get_num_threads()[source]

get_num_threads returns the number of OpenMP threads in the current team.

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

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/x06/x06abf.html

Returns
ntint

The returned number of OpenMP threads in the current team.

Notes

get_num_threads, for multithreaded implementations, returns the number of OpenMP threads in the current team. If the number of threads is deemed critical then you are advised to use get_num_threads to retrieve this value as it may be less than that requested with either a call to set_num_threads(), your OMP_NUM_THREADS environment variable value or by using a num_threads clause on an OpenMP parallel directive.

The number of threads actually in use in a parallel region is dependent on several factors. Please refer to References for a full description of how the number of threads is chosen for a particular parallel region.

If this function is called from a sequential part of a multithreaded program then it will return the value .

In serial implementations of the NAG Library this function will always return . 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