【发布时间】:2014-06-26 16:28:45
【问题描述】:
据我了解,
我可以使用single 指令做与使用sections 相同的工作,只需添加nowait 标志
与section 指令相比,以下代码对我来说没有什么不同:
void main(){
#pragma omp parallel
{
int tid = omp_get_thread_num();
#pragma omp single nowait
{
printf("Thread %d in #1 single construct.\n", tid);
}
#pragma omp single nowait
{
printf("Thread %d in #2 single construct.\n", tid);
}
#pragma omp single nowait
{
printf("Thread %d in #3 single construct.\n", tid);
}
}
}
谁能给我一些在不同场景中使用sections和single指令的例子?
【问题讨论】:
标签: c++ multithreading parallel-processing openmp directive