Share via


omp_get_num_procs

 

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

Syntax

int omp_get_num_procs();  

Remarks

For more information, see 3.1.5 omp_get_num_procs Function.

Example

// 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  

See Also

Functions