[Omp] Newbye question about workshare

Lorenzo Gontrani l.gontrani at caspur.it
Wed Jan 31 03:57:39 PST 2007


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 

Thanks in advance for any help 

Lorenzo


More information about the Omp mailing list