Less Header, Less Synchronizing

General OpenMP discussion

Less Header, Less Synchronizing

Postby varilsuhad » Thu Mar 01, 2012 2:55 am

Hi,

I got a problem similar to the thread "OpenMP help" which is 2 threads behind this thread. I'm dealing with seismic waves. My code in Fortran goes like this. It's highly simplified.

Code: Select all
do I=1,limit  !This do is time step and impossible to make parallel
!Start of parallel region
  !Bunch of work could be done in parallel using workshare and parallel do directives. In this section i use them.
!End of parallel region
enddo


As you can see in every timestep parallel region is created and destroyed which cost time to me. I'm trying to start parallel region before do loop but in that case different threads tries to grab different time steps. I tried this:
I put main do loop in ordered directive and i tried to put other parallelizable stuff in other directives but compilation failed. Basically my thought was like this

Code: Select all
!Start of parallel region
!Ordered directive
   do I=1,limit  !This do is time step and impossible to make parallel
   !Bunch of work could be done in parallel using workshare and parallel do directives. In this section i use them.
   enddo
!End of Ordered directive
!End of parallel region


Openmp forbids parallel do and workshare directives under ordered directive but i'm trying to find a way out. I'm using Intel fortran x64 v12.1 compiler on windows. But my plan is to run this on a linux workstation. Any help or suggestion is appreciated
varilsuhad
 
Posts: 2
Joined: Thu Mar 01, 2012 2:22 am

Re: Less Header, Less Synchronizing

Postby MarkB » Fri Mar 02, 2012 9:26 am

varilsuhad wrote:I'm trying to start parallel region before do loop but in that case different threads tries to grab different time steps.


This should only happen if you used a parallel do directive: a parallel directive around the time step loop should result in every thread executing the whole loop: using an ordered directive should not be required. You can then use worksharing directives inside the timestep loop (making sure you don't inadvertently create nested parallel regions!). This may reduce the overheads of starting/stopping parallel regions a little, but you will still have overheads due to the implicit barriers at the end of the worksharing construct, so your scalability may not improve that much....
MarkB
 
Posts: 487
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: Less Header, Less Synchronizing

Postby varilsuhad » Sun Mar 04, 2012 2:43 pm

Thanks for your reply, indeed, placing parallel region before do loop does not cause hat i say earlier, my bad. Based on my scheme i was able to implement a successful orphaned parallelism
varilsuhad
 
Posts: 2
Joined: Thu Mar 01, 2012 2:22 am


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 12 guests