[Omp] Newbye question about workshare

Breshears, Clay clay.breshears at intel.com
Wed Jan 31 08:36:06 PST 2007


It seems to me that there is an obvious data race, not on the loop
index, but on the dx, dy, and dz variables (vectors?).  Can you make
these private?

						clay 

-----Original Message-----
From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
Of Tim Prince
Sent: Wednesday, January 31, 2007 7:32 AM
To: l.gontrani at caspur.it
Cc: omp at openmp.org
Subject: Re: [Omp] Newbye question about workshare

l.gontrani at caspur.it wrote:
> Hi,
> I am experiencing a problem with parallizing the following f90 code (a

> pairwise distance matrix construction): 
> 
> DO i=1,int(.5*natoms)-1
>   dx=Coord(:,1)-CSHIFT(Coord(:,1),SHIFT=i)
>   dy=Coord(:,2)-CSHIFT(Coord(:,2),SHIFT=i)
>   dx=Coord(:,3)-CSHIFT(Coord(:,3),SHIFT=i)
>   dx=dx*dx
>   dy=dy*dy
>   dz=dz*dz
>   dist(natoms*(i-1)+1:natoms*li)=DSQRT(dx+dy+dz)
> ENDDO 
> 
> I was wondering if I can use the WORKSHARE construct in this case..
> I tried to use $OMP DO,private(i), but it didn't work (of course)
because of 
> the race condition for i 
Did you test it without OpenMP?  It's difficult to believe the array 
sizes match in the last assignment, or that DSQRT is appropriate.  How 
could there be a race condition on the DO index?
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp


More information about the Omp mailing list