3.1.2 omp_get_num_threads Function
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The omp_get_num_threads function returns the number of threads currently in the team executing the parallel region from which it is called. The format is as follows:
#include <omp.h>
int omp_get_num_threads(void);
The num_threads clause, the omp_set_num_threads function, and the OMP_NUM_THREADS environment variable control the number of threads in a team.
If the number of threads has not been explicitly set by the user, the default is implementation-defined. This function binds to the closest enclosing parallel directive. If called from a serial portion of a program, or from a nested parallel region that is serialized, this function returns 1.
Cross References:
OMP_NUM_THREADS environment variable, see Section 4.2 on page 48.
num_threads clause, see Section 2.3 on page 8.
parallel construct, see Section 2.3 on page 8.