openmp并行嵌套实例

//#include 
#include "stdafx.h"




void report_num_threads(int level)
{
//#pragma omp parallel
{
printf("level %d:number of threads in the team - %d\n",level,omp_get_num_threads());
}
}


int _tmain(int argc, _TCHAR* argv[])
{
omp_set_nested(1);
//omp_set_dynamic(0);
#pragma omp parallel num_threads(2)
{
//printf("here1\n");
report_num_threads(1);
#pragma omp parallel num_threads(2)
{
//printf("here1\n");
report_num_threads(2);
#pragma omp parallel num_threads(2)
{
//printf("here1\n");
report_num_threads(3);
}
}
}
return 0;
}



你可能感兴趣的:(OPENMP)