多核编程实报告2.docVIP

  • 3
  • 0
  • 约4.11万字
  • 约 11页
  • 2016-12-19 发布于河南
  • 举报
实验二 :OpenMP多线程编程 模块一:基础练习 编译执行,执行结果: (1) 简答与思考: 写出关键的并行代码 四个线程各自执行6次迭代。 // 0022.OpenMP_2.cpp : 定?§义°?控?制?台??§应?|用??程¨?序¨°的ì?入¨?口¨2点ì?。?ê //wirtten by Cosmos Wang //2010-12-16 #include stdafx.h #include omp.h int _tmain(int argc, _TCHAR* argv[]) { printf(Hello World \n); #pragma omp parallel { for(int i=0; i6; i++) { printf(Iter:%d Thread%d\n ,i,omp_get_thread_num()); } } printf(GoodBye World\n); return 0; } (2) 四个线程协同完成6次迭代。 // 0022.OpenMP_2.cpp : 定?§义°?控?制?台??§应?|用??程¨?序¨°的ì?入¨?口¨2点ì?。?ê //wirtten by Cosmos Wang //2010-12-16 #include stdafx.h #include omp.

文档评论(0)

1亿VIP精品文档

相关文档