From 3d9388f68364e8474cd88f47bd086bd8d988c726 Mon Sep 17 00:00:00 2001 From: Cezary Czaplewski Date: Tue, 20 Oct 2015 20:26:08 +0200 Subject: [PATCH] changes to avoid problems with MPI_Scatterv in mpich2 for FGPROC>1 --- source/unres/src_MD-M/lagrangian_lesyng.F | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/unres/src_MD-M/lagrangian_lesyng.F b/source/unres/src_MD-M/lagrangian_lesyng.F index f8834ea..bd7f549 100644 --- a/source/unres/src_MD-M/lagrangian_lesyng.F +++ b/source/unres/src_MD-M/lagrangian_lesyng.F @@ -124,6 +124,7 @@ c------------------------------------------------------------------ integer ierror #endif include 'COMMON.SETUP' + include 'COMMON.CONTROL' include 'COMMON.VAR' include 'COMMON.CHAIN' include 'COMMON.DERIV' @@ -282,9 +283,11 @@ c Invert the G matrix & nginv_start(0),1,MPI_INTEGER,FG_COMM,IERROR) call MPI_Allgather(myginv_ng_count,1,MPI_INTEGER, & nginv_counts(0),1,MPI_INTEGER,FG_COMM,IERROR) - write (iout,*) "nginv_start",(nginv_start(i),i=0,nfgtasks-1) - write (iout,*) "nginv_counts",(nginv_counts(i),i=0,nfgtasks-1) - call flush(iout) + if (lprn .and. (me.eq.king .or. .not. out1file) ) then + write (iout,*) "nginv_start",(nginv_start(i),i=0,nfgtasks-1) + write (iout,*) "nginv_counts",(nginv_counts(i),i=0,nfgtasks-1) + call flush(iout) + endif c call MPI_Scatterv(ginv(1,1),nginv_counts(0), c & nginv_start(0),MPI_DOUBLE_PRECISION,ginv, c & myginv_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR) @@ -476,7 +479,7 @@ c--------------------------------------------------------------------------- include 'COMMON.TIME1' include 'COMMON.MD' double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00 - &time01 + &,time01,zcopy(dimen3) #ifdef MPI if (nfgtasks.gt.1) then if (fg_rank.eq.0) then @@ -497,7 +500,10 @@ c call MPI_Barrier(FG_COMM,IERROR) time00=MPI_Wtime() call MPI_Scatterv(z,ng_counts(0),ng_start(0), & MPI_DOUBLE_PRECISION, - & z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR) + & zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR) + do i=1,3*my_ng_count + z(i)=zcopy(i) + enddo c write (2,*) "My chunk of z" c do i=1,3*my_ng_count c write (2,*) i,z(i) @@ -628,7 +634,7 @@ c--------------------------------------------------------------------------- include 'COMMON.LANGEVIN.lang0' #endif double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00 - &time01 + &,time01,zcopy(dimen3) #ifdef MPI if (nfgtasks.gt.1) then if (fg_rank.eq.0) then @@ -642,7 +648,11 @@ c call MPI_Barrier(FG_COMM,IERROR) time00=MPI_Wtime() call MPI_Scatterv(z,ng_counts(0),ng_start(0), & MPI_DOUBLE_PRECISION, - & z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR) + & zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR) + + do i=1,3*my_ng_count + z(i)=zcopy(i) + enddo c write (2,*) "My chunk of z" c do i=1,3*my_ng_count c write (2,*) i,z(i) -- 1.7.9.5