OPENMP Performance Problem

General OpenMP discussion
Post Reply
chenzx
Posts: 2
Joined: Mon Jun 08, 2020 10:22 pm

OPENMP Performance Problem

Post by chenzx »

I am trying parallelizing part of code with OPENMP in hybrid MPI/OPENMP environment and currently have some performance problem when OPENMP is activated.

I did a very simple test by put the following 3 lines somewhere in the code (basically I initialize 4 thread and a parallel region with OPENMP)

Code: Select all

call omp_set_num_threads(4)
[code]!$OMP PARALLEL

Code: Select all

!$OMP END PARALLEL
[/code]

I am using Intel compiler with “-qopenmp” to activate the multi-threading. I run my MPI/OPENMP with 1 process and expecting the problem will fire 4 threads when it enters the parallel region.

However, even though I put a parallel region which basically does nothing, I see a significant impact on the performance. The total run time of my program linearly increase with the increase of number of threads (i.e. with 2 threads almost 2 times slower and with 4 threads almost 4 times slower)

I am wondering if there maybe something missing in my experiment (e.g. complier option, system setting for example hyper-threading in the cluster etc?) to optimize the performance for OPENMP.

MarkB
Posts: 803
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: OPENMP Performance Problem

Post by MarkB »

What are you using to measure the execution time?

chenzx
Posts: 2
Joined: Mon Jun 08, 2020 10:22 pm

Re: OPENMP Performance Problem

Post by chenzx »

Very simple test on performance
1. I compiled the program without this additional three line, run the program, say it takes 10 minutes
2. I compiled the program with this additional three line, run the program, now it takes 30 minutes
I do not understand this time increase. More threads I declared, the program runs slower.
The weird thing is that though I just declared a parallel region doing nothing there is huge impact on the performance. This is a hybrid mpi/openmp program, but in my test I just run the program with 1 core for the MPI. I guess there maybe something I am missing in the system setting for the cluster or some option is missing when I compile. I compile this FORTRAN code with (-O2 -qopenmp) using Intel compiler.

MarkB
Posts: 803
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: OPENMP Performance Problem

Post by MarkB »

The OpenMP runtime will create threads even though the parallel region does nothing, and these may well stay alive and consume CPU resources outside of the parallel regions. What could be happening is that the threads are being bound to the same core as the MPI process. You may need to set some flags on your MPI launcher program (mpirun/mpiexec etc.) to fix this.

Post Reply