[Omp] Newbye question about workshare

Tim Prince n8tm at aol.com
Wed Jan 31 05:32:14 PST 2007


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?


More information about the Omp mailing list