3.1.10 omp_get_nested – Nested parallel regions

Description:

This function returns true if nested parallel regions are enabled, false otherwise. Here, true and false represent their language-specific counterparts.

The state of nested parallel regions at startup depends on several environment variables. If OMP_MAX_ACTIVE_LEVELS is defined and is set to greater than one, then nested parallel regions will be enabled. If not defined, then the value of the OMP_NESTED environment variable will be followed if defined. If neither are defined, then if either OMP_NUM_THREADS or OMP_PROC_BIND are defined with a list of more than one value, then nested parallel regions are enabled. If none of these are defined, then nested parallel regions are disabled by default.

Nested parallel regions can be enabled or disabled at runtime using omp_set_nested, or by setting the maximum number of nested regions with omp_set_max_active_levels to one to disable, or above one to enable.

Note that the omp_get_nested API routine was deprecated in the OpenMP specification 5.2 in favor of omp_get_max_active_levels.

C/C++:
Prototype:int omp_get_nested(void);
Fortran:
Interface:logical function omp_get_nested()
See also:

omp_get_max_active_levels – Current maximum number of active regions, omp_set_nested – Enable/disable nested parallel regions, OMP_MAX_ACTIVE_LEVELS – Set the maximum number of nested parallel regions, OMP_NESTED – Nested parallel regions

Reference:

OpenMP specification v4.5, Section 3.2.11.