Compartir a través de


3.1.2 omp_get_num_threads Function

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: