openmp
openmp编程报错:
error: work-sharing region may not be closely nested inside of work-sharing, ‘critical’, ‘order ’, ‘master’, explicit ‘task’ or ‘task loop’ region
stackoverflow:
A worksharing region may not be closely nested inside a worksharing, explicit TASK, CRITICAL, ORDERED, or MASTER region.
(工作共享区域可能不能紧密地嵌套在工作共享、显式任务、关键、有序或主区域中。)
错误用法:
#pragma omp parallel for [clase]
{
#pragma omp single
{
do_something
}
loop()
}
分析:并行化嵌套使用错误,par_for下已经建立共享区,不能类似嵌套使用共享区。
正确用法:
#pragma omp parallel
{
#pragma omp single
{
do_something
}
#pragma omp for
loop()
}
流转星云