0

I have a need to continue execution as soon as one of the threads has finished execution. The logic inside the parallel section with ensure that everything has been completed satisfactorily. I have nested parallelisation therefore I put some of the top level threads to Sleep when data is not ready to be processed as not to consume computation power. So when one of the top level threads finishes I want to continue execution and not wait for the other threads to wake up and naturally return.

I use

#pragma omp parallel for num_threads(wanted_thread_no)
4

1 回答 1

0

你如何并行化?您使用任务、部分还是?

如果我理解正确并且如果您使用任务原语,您可以#pragma omp parallel nowait在最后一个任务之后使用。

在第 13 页检查此 pdf(pdf)。

http://openmp.org/wp/presos/omp-in-action-SC05.pdf

它明确地说:

默认情况下,“omp for”末尾有一个障碍。使用“nowait”子句关闭屏障。 #pragma omp for nowait“nowait”在两个连续的、独立的 omp for 循环之间很有用。

这是你想要的吗?

也要看看这个,即使它说的是同样的事情。

http://openmp.org/mp-documents/omp-hands-on-SC08.pdf

于 2012-12-13T00:20:50.610 回答