我正在运行嵌套for循环,外部并行化,我想打破内循环
#pragma omp parallel for default(shared) private(found, i, j)
for (i=0;i<N;i++) {
found = 0;
for (j=0;j<count;j++) {
if (isFound(i,j)) {
#pragma omp critical
if (isFound(i,j)) {
found = 1;
break;
}
}
}
functionX(found);
}
据我所知,这在功能上没有问题,但是不允许编译。有解决方法吗?
编辑:按要求编译错误:
error: "break" branches to or from an OpenMP structured block are illegal
break;
^
compilation aborted for file.c (code 2)
make: *** [file.o] Error 2