NAG CL Interface
x06agc (set_​nested)

Note: this function is deprecated and will be withdrawn at Mark 31.3. Replaced by x06ajc.

Old Code

nag_omp_set_nested(nesting)

New Code

nag_omp_set_max_active_levels(num, &ifail)
if nesting would be set to 0 then num must be 1. If nesting would be set to 1 set num to the number of nested active parallel regions required.
Settings help

CL Name Style:


1 Purpose

x06agc enables or disables nested OpenMP parallelism.

2 Specification

#include <nag.h>
void  x06agc (Integer nesting)
The function may be called by the names: x06agc or nag_omp_set_nested.

3 Description

x06agc, for multithreaded implementations, enables or disables the nesting of OpenMP parallel regions by setting an OpenMP Internal Control Variable (ICV) and any vendor library specific options where that is possible. See the Users' Note for your implementation for details of the scope of x06agc.
Nesting is disabled by default in OpenMP.
In serial implementations of the NAG Library x06agc has no effect. See the Chapter X06 for a discussion of the behaviour of these functions 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

1: nesting Integer Input
On entry: if nesting=0, nesting of OpenMP parallel regions is disabled, otherwise it is enabled.

6 Error Indicators and Warnings

None.

7 Accuracy

Not applicable.

8 Parallelism and Performance

x06agc is not threaded in any implementation.

9 Further Comments

None.

10 Example

In this example we presume a multithreaded implementation of the NAG Library. We call x06agc to enable the nesting of OpenMP parallel regions by setting an ICV. Inside a first, or ‘outer’, parallel region we call x06ahc to display the status of nesting, and expect to see it return the value 1.
Each thread then spawns a second ‘inner’ parallel region. Within this region we have each thread increment the value total. As there are 5 threads in the outer region and 3 threads in each inner region we expect the final value of this variable to be 15.
If you use a serial implementation of the NAG Library, regardless of whether the code is compiled with OpenMP or not, x06agc will have no effect and x06ahc will always return 0. The total number of threads will be 1. The appropriate results file will be included with the distribution material for your implementation.

10.1 Program Text

Program Text (x06agce.c)

10.2 Program Data

None.

10.3 Program Results

Program Results (x06agce.r)