Horrible slow down in my OpenMP code

General OpenMP discussion

Horrible slow down in my OpenMP code

Postby kazempour » Mon Jul 30, 2012 3:02 am

I recently implemented OpenMP on an available MPI based parallel code, and after I run the program the execution time became 150 times! slower than noramal (MPI) code, and it is because of the below loop: (my implementation is in fortran 77 environment!)

!$omp parallel
!$omp& shared ( imyfriends )
!$omp& private ( ind )
!$omp do
DO ind=1,2048
imyfriends(ind,1)=-2
imyfriends(ind,2)=-2
ENDDO
!$omp end do
!$omp end parallel

Do I implement the code in a wrong way? Do you have any Idea about this timing probem?
I'm looking forward to your replies ... ;)

Best Regards
kazempour
 
Posts: 13
Joined: Wed Jul 25, 2012 4:11 am

Re: Horrible slow down in my OpenMP code

Postby MarkB » Mon Jul 30, 2012 7:20 am

Most likely the loop in your code executes too quickly for parallelisation to be worthwhile. As a general rule-of-thumb, a loop needs have a sequential execution time of several tens of microseconds before the benefits of distributing the work across threads outweigh the overheads of starting and stopping an OpenMP parallel region.
MarkB
 
Posts: 447
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: Horrible slow down in my OpenMP code

Postby kazempour » Tue Jul 31, 2012 5:55 am

MarkB wrote:Most likely the loop in your code executes too quickly for parallelisation to be worthwhile. As a general rule-of-thumb, a loop needs have a sequential execution time of several tens of microseconds before the benefits of distributing the work across threads outweigh the overheads of starting and stopping an OpenMP parallel region.


Dear Mark,
Thank you for your kind help, I checked the program and I realized that my compiler doesn't support Hybrid OpenMP/MPI and it causes some problem! because I checked this part of code by pure OpenMP and I reached a good efficiency; so I have to solve my compiler problems. Thank you again for your helps ;)
kazempour
 
Posts: 13
Joined: Wed Jul 25, 2012 4:11 am

Re: Horrible slow down in my OpenMP code

Postby ftinetti » Tue Jul 31, 2012 6:45 am

Hi kazempour,

I do not understand
my compiler doesn't support Hybrid OpenMP/MPI

since compilers are not expected to support MPI. Furthermore, we use MPI implementations in the form of a library + some utility programs. I'm curious, what is the compiler and computer you are using?

Thanks in advance,

Fernando.
ftinetti
 
Posts: 581
Joined: Wed Feb 10, 2010 2:44 pm

Re: Horrible slow down in my OpenMP code

Postby kazempour » Wed Aug 01, 2012 8:29 am

I actually solved the problem; as my code is a hybrid OpenMP/MPI code and my compiler was intel mvapich 1.2.0, I had to call MPI_INIT_THREAD before running the whole program! otherwise all parallel works will done by one thread and may be 4 times!!! (worst than sequential type)
By the way thanks everyone who helped me in this topic! :)
Regards
Mahdi
kazempour
 
Posts: 13
Joined: Wed Jul 25, 2012 4:11 am


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 4 guests