[Beowulf] OpenMP wierdness on dual AMD 2350 box w/ SL5.2 x86_64
Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.
Nathan Moore ntmoore at gmail.comThu Nov 27 06:50:25 PST 2008
- Previous message: [Beowulf] cli alternative to cluster top?
- Next message: [Beowulf] SSH to compute nodes hangs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dmitri,
Perfect! Thanks so much for the response. Your guess about the barrier was
exactly correct. The problem has disappeared.
I was ignorant about the proper way to specify shared variables. Thanks for
the correction. Is the following use of reduction acceptable?
!$OMP PARALLEL
!$OMP& PRIVATE(i,j)
!$OMP& SHARED(Ny,Nx,dv,v,boundary))
!
!$OMP DO
...
...
!$OMP END DO
max_dv = 0.d0
!$OMP BARRIER
!$OMP DO
!$OMP& REDUCTION(MAX:max_dv)
do j=2,(Ny-1)
do i=2,(Nx-1)
v(i,j) = v(i,j) + dv(i,j)
if(dabs(dv(i,j)) .gt. max_dv) then
max_dv = dv(i,j)
endif
end do
end do
!$OMP END DO
On Thu, Nov 27, 2008 at 4:07 AM, Dmitri Chubarov
<dmitri.chubarov at gmail.com>wrote:
> Nathan, hello,
>
> I gave your code a second look and noticed this:
>
> !$OMP PARALLEL
>>
>
>> !$OMP DO
>>
> ....
>> !$OMP END DO
>>
>> max_dv = 0.d0
>> !$OMP DO
>>
> ....
>
>> !$OMP END DO
>> !$OMP END PARALLEL
>>
>>
> There is a BARRIER missing between max_dv = 0.d0 and the following loop.
> One of the threads in the pool might've been late and get to this statement
> when the rest have already completed the reduction loop.
>
> The barrier is also important to ensure that no thread would use the values
> of dv(i,j) in the reduction loop before they are updated by the main
> computational loop above.
>
> Finally
> if(dv(i,j) .gt. max_dv) then
> max_dv = dv(i,j)
> endif
> Does not look right since it would not handle negative values of dv(i,j)
> correctly. I assume it should read
> as
> max_dv = max(max_dv, dabs(dv(i,j) ))
>
> Best regards,
> Dmitri Chubarov
>
> --
> Junior Researcher
> Siberian Branch of the Russian Academy of Sciences
> Institute of Computational Technologies
>
>
--
- - - - - - - - - - - - - - - - - - - - -
Nathan Moore
Assistant Professor, Physics
Winona State University
AIM: nmoorewsu
- - - - - - - - - - - - - - - - - - - - -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scyld.com/pipermail/beowulf/attachments/20081127/5346f032/attachment.html
- Previous message: [Beowulf] cli alternative to cluster top?
- Next message: [Beowulf] SSH to compute nodes hangs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Beowulf mailing list
