NAG FL Interface
x06abf (get_​num_​threads)

Settings help

FL Name Style:

FL Specification Language:

1 Purpose

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

2 Specification

Fortran Interface
Function x06abf ( )
Integer :: x06abf
C Header Interface
#include <nag.h>
Integer  x06abf_ ()
The routine may be called by the names x06abf or nagf_omp_get_num_threads.

3 Description

x06abf, 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 x06abf to retrieve this value as it may be less than that requested with either a call to x06aaf, 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 Section 4 for a full description of how the number of threads is chosen for a particular parallel region.
If this routine is called from a sequential part of a multithreaded program then it will return the value 1.
In serial implementations of the NAG Library this routine will always return 1. See the X06 Chapter Introduction for a discussion of the behaviour of these routines when called in serial.

4 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

5 Arguments


6 Error Indicators and Warnings


7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
x06abf is not threaded in any implementation.

9 Further Comments


10 Example

See x06aaf for a demonstration of how to use x06abf.