Using OpenMP (libgomp) in an already multi-threaded application

We use OpenMP (libgomp) to speed up some computations in a multi-threaded Qt application. OpenMP parallel sections are located in two different threads, although in reality they are never executed in parallel. In this case, we observe that omp 2N flows (where N = OMP_THREAD_LIMIT) omp, apparently interfering with each other. The calculation time is very long, and the processor load is low. The setting is OMP_WAIT_POLICYunlikely to have any effect.

We also tried to move all omp sections to a single thread (this is not a good solution for us, but from an architectural point of view). In this case, the total calculation time is reduced and the processor is fully loaded, but only if it is OMP_WAIT_POLICYset to ACTIVE. When OMP_WAIT_POLICY == PASSIVE, the calculation time remains low, and the processor is idle 50% of the time.

Oddly, when we use omp in a single thread, the first loop parallelized using omp (in the omp calulations series) runs 10 times slower than the multi-threaded case.

Update: Our questions:

a) is there a way to reuse openmp streams when using omp in the context of different streams.

b) Why doing with OMP_WAIT_POLICY == PASSIVEslows things down. Does it take so long to wake up flows?

c) - , ( )

2:. , , , GNU OMP. icc .

+3
1

/ openmp omp_set_num_threads(1) omp_set_num_threads(cpucount)

(1) openmp, (cpu_num) .

, omp_set_num_threads(1). omp- omp WAIT_POLICY=active, .

omp .

omp_set_num_threads(cpucount) , , wait_policy = passive. (c) - libgomp .

+1

Source: https://habr.com/ru/post/1779196/


All Articles