正在加载图片...
中图种学学计算机科学与术系 University of Science and Technology of China DEPARTMENT DF COMPUTE三巴 ENCE AND ECHNOLDD 一个简单的 OpenMP程存实例 基于c/C+语言的 OpenMP程序结构的一个具体实现 #include " omp. h int main( int argc, char argvD roc char buf 32] / Fork a team of threads * #pragma omp parallel private(nthreads, tid) Obtain and print thread id*/ tid=omp get thread numo; printf("Hello World from OMP thread %d\n", tid) Only master thread does this */ nthreads =omp get num threads; printf( " Number of threads %dln", nthreads); return 0 国家高性能计算中心(合肥) 2021/2/3 13国家高性能计算中心(合肥) 13 2021/2/3 一个简单的OpenMP程序实例 ▪ 基于C/C++语言的OpenMP程序结构的一个具体实现 #include "omp.h" int main(int argc, char* argv[]) { int nthreads, tid; int nprocs; char buf[32]; /* Fork a team of threads */ #pragma omp parallel private(nthreads, tid) { /* Obtain and print thread id */ tid = omp_get_thread_num(); printf("Hello World from OMP thread %d\n", tid); /* Only master thread does this */ if (tid==0) { nthreads = omp_get_num_threads(); printf("Number of threads %d\n", nthreads); } } return 0; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有