【发布时间】:2012-02-14 12:06:53
【问题描述】:
我有一个单独的块包含在这样的部分块中
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int main (int argc, char *argv[])
{
int nthreads, tid;
/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(tid)
{
#pragma omp sections
{
#pragma omp section
{
printf("First section %d \n" , tid);
}
#pragma omp section
{
#pragma omp single
{
printf("Second Section block %d \n" , tid);
}
}
}
} /* All threads join master thread and disband */
printf("Outside parallel block \n");
}
当我编译这段代码时,编译器会给出以下警告
工作共享区域不能紧密嵌套在工作共享、关键、有序或主区域内
为什么会这样?
【问题讨论】: