您的位置:首页 > 运维架构

OpenMP: OpenMP并行嵌套实例

2013-04-16 10:43 246 查看
//#include <stdio>   
#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;  
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: