Export (0) Print
Expand All

omp_get_num_procs

Returns the number of processors that are available when the function is called.

int omp_get_num_procs();

// omp_get_num_procs.cpp
// compile with: /openmp
#include <stdio.h>
#include <omp.h>

int main( ) 
{
    printf_s("%d\n", omp_get_num_procs( ));
    #pragma omp parallel
        #pragma omp master
        {
            printf_s("%d\n", omp_get_num_procs( ));
        }
}
// Expect the following output when the example is run on a two-processor machine:
2
2
Show:
© 2014 Microsoft