why my program is running slower after using openMP?

Our team is optimizing a program written with FORTRAN, We used Intel VTune Amplifier to locate the HOTSPOTS FUNCTION. It was a confusing subroutine with many many loops. One of which was a near 3000-lines loop with many other loops inside.
We used openMP to rewrite most of the long loops inside the biggest loop. We set the located variables as private and used schedule(dynamic)redirection just because the number of iteration will change frequently with the running of the process. But to our surprise, the program runs much slower with openMP that it takes 31s to finish while no-openMP takes only 26s.
We used VTune to analyze the program again and noticed function named like omg_barrier cost too much time. How can we solve it?
NOTICE:
1.We’ve set export OMP_THREADS=24 before executing the program because our GPU has 24 processors.
2.the "omg_barrier"s including “mp_brarrier_tw”,“mp_barrirer1”,“mp_barrier2”, “mp_pcpu_wait”
3.What on earth the "mp_barrier"s are?
4.What I can do to deal with this?

Hi Rain1001,

We used openMP to rewrite most of the long loops inside the biggest loop. We set the located variables as private and used schedule(dynamic)redirection just because the number of iterations will change frequently with the running of the process.

What’s the time if you use a “static” schedule? Dynamic scheduling does cause extra overhead and is best used when each loop iteration takes a variable amount of time. It shouldn’t be needed if the number of iterations change.

1.We’ve set export OMP_THREADS=24 before executing the program because our GPU has 24 processors.

Do you mean CPUs not GPUs?

3.What on earth the "mp_barrier"s are?

A barrier occurs when an OpenMP thread is waiting. It can occur at a “!$OMP BARRIER” directive, a critical section, or when waiting for the next parallel region. My best guess is that most of your time is being spent in serial code, with the “mp_barrier” calls being the time the helper threads are waiting on the master thread.

4.What I can do to deal with this?

Without an example or more details about your program, it’s very difficult to give any advice here.


-Mat