次の方法で共有


A.28 Use of num_threads Clause

 

The following example demonstrates the num_threads clause (Section 2.3 on page 8). The parallel region is executed with a maximum of 10 threads.

#include <omp.h>  
main()  
{  
    omp_set_dynamic(1);  
    ...  
    #pragma omp parallel num_threads(10)  
    {  
        ... parallel region ...  
    }  
}