PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Problem with OpenMP
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Killer_R



Joined: 18 Aug 2008
Posts: 4

PostPosted: Mon Aug 18, 2008 8:29 am    Post subject: Problem with OpenMP Reply with quote

Hi,

I originally posted this in the forum on OpenMP's website, but they said to try to post it here. The original question is here: http://openmp.org/forum/viewtopic.php?f=3&t=215.

I am trying to compile this with the PGI Fortran compiler version 6.1 on a 64 bit system. But it seems that it has some problems with OpenMP.

The code is shown below, and to get a full description of the problem, please see the above link...

Code:
   Amax = 0.0_dbl
   !$OMP PARALLEL DEFAULT(SHARED) PRIVATE(j,alpha,beta,nu,A,priv_max,priv_numax)
   priv_max = 0.0_dbl
   !$OMP DO
   do j = 1,Nspec
      nu = nu_min+dF*(j-1)
   
      ! Calculate amplitude:
      call CalcAlphaBeta(t,f,w,nu,alpha,beta)
      A = sqrt(alpha**2 + beta**2)
       
      if (A > priv_max) then
         priv_max = A
         priv_numax = nu
      endif
   enddo
   !$OMP END DO NOWAIT
   !$OMP FLUSH
   if (priv_max > Amax) then
      !$OMP CRITICAL
         if (priv_max > Amax) then
            print *, priv_max
            Amax = priv_max
            !$OMP FLUSH
            numax = priv_numax
         endif
      !$OMP END CRITICAL
   endif
   !$OMP END PARALLEL
   
! If this line is included it works?! WHY?!
!   print *, 'Result: ', Amax


Please help... I will be really grateful!

Best regards,
/Rasmus
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6208
Location: The Portland Group Inc.

PostPosted: Mon Aug 18, 2008 9:14 am    Post subject: Reply with quote

Hi Rasmus,

What happens if you remove the outer if statement for "priv_max > Amax" or place it under the critical section? Having Amax outside of the critical section is most likely cause of the error.

- Mat
Back to top
View user's profile
Killer_R



Joined: 18 Aug 2008
Posts: 4

PostPosted: Mon Aug 18, 2008 12:20 pm    Post subject: No... Reply with quote

No, that doesn't help... Same thing...

/Rasmus
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6208
Location: The Portland Group Inc.

PostPosted: Mon Aug 18, 2008 1:43 pm    Post subject: Reply with quote

Ok. I'll need to be able to compile the source and run the exe to determine what's happening. Can you send and example to PGI customer support (trs@pgroup,com) along with instructions and ask them to forward it to me?

Thanks,
Mat
Back to top
View user's profile
Killer_R



Joined: 18 Aug 2008
Posts: 4

PostPosted: Tue Aug 19, 2008 2:18 am    Post subject: Sent... Reply with quote

I have now sent you the source code.
Hope you can find the error...

/Rasmus
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group