change of shield sending and receiving buff in MPI
authorAdam Sieradzan <adasko@piasek4.chem.univ.gda.pl>
Mon, 9 May 2016 17:44:10 +0000 (19:44 +0200)
committerAdam Sieradzan <adasko@piasek4.chem.univ.gda.pl>
Mon, 9 May 2016 17:44:10 +0000 (19:44 +0200)
source/unres/src_MD-M/energy_p_new_barrier.F

index c0670a7..6078e06 100644 (file)
@@ -28,6 +28,12 @@ cMS$ATTRIBUTES C ::  proc_proc
       include 'COMMON.TIME1'
       include 'COMMON.SPLITELE'
       include 'COMMON.SHIELD'
+      double precision fac_shieldbuf(maxres),
+     & grad_shield_locbuf(3,maxcontsshi,-1:maxres),
+     & grad_shield_sidebuf(3,maxcontsshi,-1:maxres),
+     & grad_shieldbuf(3,-1:maxres)
+       integer ishield_listbuf(maxres),
+     &shield_listbuf(maxcontsshi,maxres)
 #ifdef MPI      
 c      print*,"ETOTAL Processor",fg_rank," absolute rank",myrank,
 c     & " nfgtasks",nfgtasks
@@ -162,34 +168,50 @@ C#define DEBUG
      &  grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
        enddo
 #endif
-       call MPI_Allgatherv(fac_shield(ivec_start),ivec_count(fg_rank1),
-     &  MPI_DOUBLE_PRECISION,fac_shield(1),ivec_count(0),ivec_displ(0),
+       call MPI_Allgatherv(fac_shield(ivec_start),
+     &  ivec_count(fg_rank1),
+     &  MPI_DOUBLE_PRECISION,fac_shieldbuf(1),ivec_count(0),
+     &  ivec_displ(0),
      &  MPI_DOUBLE_PRECISION,FG_COMM,IERR)
        call MPI_Allgatherv(shield_list(1,ivec_start),
      &  ivec_count(fg_rank1),
-     &  MPI_I50,shield_list(1,1),ivec_count(0),
+     &  MPI_I50,shield_listbuf(1,1),ivec_count(0),
      &  ivec_displ(0),
      &  MPI_I50,FG_COMM,IERR)
        call MPI_Allgatherv(ishield_list(ivec_start),
      &  ivec_count(fg_rank1),
-     &  MPI_INTEGER,ishield_list(1),ivec_count(0),
+     &  MPI_INTEGER,ishield_listbuf(1),ivec_count(0),
      &  ivec_displ(0),
      &  MPI_INTEGER,FG_COMM,IERR)
        call MPI_Allgatherv(grad_shield(1,ivec_start),
      &  ivec_count(fg_rank1),
-     &  MPI_UYZ,grad_shield(1,1),ivec_count(0),
+     &  MPI_UYZ,grad_shieldbuf(1,1),ivec_count(0),
      &  ivec_displ(0),
      &  MPI_UYZ,FG_COMM,IERR)
        call MPI_Allgatherv(grad_shield_side(1,1,ivec_start),
      &  ivec_count(fg_rank1),
-     &  MPI_SHI,grad_shield_side(1,1,1),ivec_count(0),
+     &  MPI_SHI,grad_shield_sidebuf(1,1,1),ivec_count(0),
      &  ivec_displ(0),
      &  MPI_SHI,FG_COMM,IERR)
        call MPI_Allgatherv(grad_shield_loc(1,1,ivec_start),
      &  ivec_count(fg_rank1),
-     &  MPI_SHI,grad_shield_loc(1,1,1),ivec_count(0),
+     &  MPI_SHI,grad_shield_locbuf(1,1,1),ivec_count(0),
      &  ivec_displ(0),
      &  MPI_SHI,FG_COMM,IERR)
+       do i=1,nres
+        fac_shield(i)=fac_shieldbuf(i)
+        ishield_list(i)=ishield_listbuf(i)
+        do j=1,3
+        grad_shield(j,i)=grad_shieldbuf(j,i)
+        enddo !j
+        do j=1,ishield_list(i)
+          shield_list(j,i)=shield_listbuf(j,i)
+         do k=1,3
+         grad_shield_loc(k,j,i)=grad_shield_locbuf(k,j,i)
+         grad_shield_side(k,j,i)=grad_shield_sidebuf(k,j,i)
+         enddo !k
+       enddo !j
+      enddo !i
 #ifdef DEBUG
        write(iout,*) "after reduce fac_shield reduce"
        do i=1,nres