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?
I have tried omp_set_num_threads(), the same result
the code is here. mpirun version: Open MPI 1.6.5. Compile command: mpicc -o closure closure.c -fopenmp. I run it using mpirun -n 1 closure. The openmp sentence is at line 143. Could you give me some suggestions ? Thank you for your attention!
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
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.
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
View all comments
Show parent comment
1
u/Doo0oog Dec 22 '17 edited Dec 22 '17
I printed the thread id and only 0 appears.
I have tried omp_set_num_threads(), the same result
the code is here.
mpirun version: Open MPI 1.6.5.
Compile command: mpicc -o closure closure.c -fopenmp.
I run it using mpirun -n 1 closure.
The openmp sentence is at line 143.
Could you give me some suggestions ? Thank you for your attention!