NAG Library Function Document

nag_omp_get_max_threads (x06acc)

 Contents

    1  Purpose
    7  Accuracy
    9  Example

1
Purpose

nag_omp_get_max_threads (x06acc) returns an upper bound on the number of threads used for subsequent OpenMP parallel regions.

2
Specification

#include <nag.h>
#include <nagx06.h>
Integer  nag_omp_get_max_threads ()

3
Description

nag_omp_get_max_threads (x06acc), for multi-threaded implementations, returns the number of the threads to be requested for subsequent parallel regions. The value is the first element of the list held by the OpenMP Internal Control Variable (ICV) used in determining the number of threads. See Users' Note for your implementation for details of the scope of this function.
The number of threads used in parallel regions will be equal to, or less than, the first 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 Section 4 for a full description of how the number of threads is chosen for a particular parallel region.
In serial implementations of the NAG C Library this function will always return 1. See the x06 Chapter Introduction for a discussion of the behaviour of these functions when called in serial.

4
References

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

5
Arguments

None.

6
Error Indicators and Warnings

None.

7
Accuracy

Not applicable.

8
Further Comments

None.

9
Example

See Section 10 in nag_omp_set_num_threads (x06aac) for a demonstration of how to use nag_omp_get_max_threads (x06acc).
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017