HP aC++/HP C A.06.20 Programmer's Guide

The OMP_NESTED environment variable enables or disables nested parallelism. Its
value must be TRUE or FALSE.
If the value is set to TRUE, nested parallelism is enabled and if the value is set to FALSE,
the nested parallelism is disabled. The default value is FALSE.
Runtime Library Functions in OpenMP
The OpenMP library functions are external functions. The header <omp.h> declares
three types of functions:
Several functions that can be used to control and query the parallel execution
environment.
Lock functions that can be used to synchronize access to data.
Timing functions that support a wall-clock timer.
Description of library functions are divided into the following topics:
Execution Environment Functions
Lock Functions
Timing Functions
Execution Environment Functions
The execution environment functions affect and monitor threads, processors, and the
parallel environment. This section discusses the following environment functions:
omp_set_num_threads
omp_get_num_threads
omp_get_max_threads
omp_get_thread_num
omp_get_num_procs
omp_in_parallel
omp_set_dynamic
omp_get_dynamic
omp_set_nested
omp_get_nested
omp_set_num_threads
#include <omp.h>
void omp_set_num_threads(int num_threads);
The omp_set_num_threads function sets the number of threads to use for subsequent
parallel regions. The value of the parameter num_threads must be positive. Its effect
depends upon whether dynamic adjustment of the number of threads is enabled. If
dynamic adjustment is disabled, the value is used as the number of threads for all
subsequent parallel regions prior to the next call to this function; otherwise, the value
Parallel Programming Using OpenMP 221