NAG Library Function Document
nag_omp_get_num_threads (x06abc) returns the number of OpenMP threads in the current team.
, for multi-threaded 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 nag_omp_get_num_threads (x06abc)
to retrieve this value as it may be less than that requested with either a call to nag_omp_set_num_threads (x06aac)
, your OMP_NUM_THREADS environment variable value or by using a num_threads
clause on an OpenMP parallel
The number of threads actually in use in a parallel region is dependent on several factors. Please refer to Section 4
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 multi-threaded program then it will return the value .
In serial implementations of the NAG C Library this function will always return
. See the x06 Chapter Introduction
for a discussion of the behaviour of these functions when called in serial.
OpenMP Specifications http://openmp.org/
Chapman B, Jost G and van der Pas R (2008) Using OpenMP Portable Shared Memory Parallel Programming The MIT Press
Error Indicators and Warnings
Parallelism and Performance
nag_omp_get_num_threads (x06abc) is not threaded in any implementation.
See Section 10
in nag_omp_set_num_threads (x06aac)
for a demonstration of how to use nag_omp_get_num_threads (x06abc)