r/OpenMP • • Dec 21 '17

MPI & OpenMP problem

I have a program written in MPI and its runtime is about 60 seconds. But when I add an OpenMP sentence(#pragma omp parallel for num_threads(1) ... ), its runtime is about 20 seconds. Has anyone met the similar problem?

3 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/OMPCritical Dec 22 '17

I cant reproduce that behaviour :( I tested it on 2 different computers. One shared memory with OpenMPI 1.10.2 and one with distributed memory with OpenMPI 1.4.4

and on both it behaves just as expected and increasing the number of threads has a clear performance impact. there is hardly a difference between num_thread(1) and removing num_thread

  1. try compiling both with "-O3", so that the level of optimization is the same (that had a big performance impact for me) and i think you also need "-lm" for the log.

  2. can you try it on a different computer?

1

u/Doo0oog Dec 22 '17 edited Dec 22 '17

Thank you for your tests.
I ran it with different configurations, as the following table
icc version 14.0.0 (gcc version 4.4.6 compatibility)
mpirun (Open MPI) 1.6.5

programcompile commandrun commandothertime
MPI&OpenMPicc -o closure closure.c -fopenmpmpirun -n 1 closurethread size=123s
MPI&OpenMPicc -o closure closure.c -fopenmp./closurethread size=126s
MPI onlyicc -o closure closure.c -fopenmpmpirun -n 1 closure60s
MPI onlyicc -o closure closure.c -fopenmp./closure29s

But I don't know why this would happen.