From 19483947cd6f85a7589a363dd91eb16d147f591a Mon Sep 17 00:00:00 2001 From: ESCOBAR Juan <escj@nuwa> Date: Mon, 14 Mar 2022 19:05:34 +0100 Subject: [PATCH] Juan 14/03/2022:tensor/communication.f90,some GPU optimisation & replace floor -> nint for pb with Cray Compiler --- .../communication.f90 | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90 b/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90 index 6b86c4adf..6ec3b197d 100644 --- a/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90 +++ b/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90 @@ -215,8 +215,10 @@ contains call mpi_comm_rank(MPI_COMM_WORLD, rank, ierr) i_am_master_mpi = (rank == master_rank) ! Check that nproc = 2^(2*p) - pproc = floor(log(1.0d0*nproc)/log(4.0d0)) + !pproc = floor(log(1.0d0*nproc)/log(4.0d0)) + pproc = nint(log(1.0d0*nproc)/log(4.0d0)) if ( (nproc - 4**pproc) .ne. 0) then + print*,"Number of processors has to be 2^(2*pproc) with integer nproc,pproc=",nproc,pproc call fatalerror("Number of processors has to be 2^(2*pproc) with integer pproc.") end if if (i_am_master_mpi) then @@ -499,6 +501,9 @@ contains ! Scalar product of two fields !================================================================== subroutine scalarprod_mnh(m, a, b, s) +#ifdef MNH + USE MODE_MPPDB +#endif implicit none integer, intent(in) :: m type(scalar3d), intent(in) :: a @@ -516,6 +521,7 @@ contains real(kind=rl) :: ddot integer :: iy_min,iy_max, ix_min,ix_max + integer :: icompy_min,icompy_max, icompx_min,icompx_max real , dimension(:,:,:) , pointer , contiguous :: za_st,zb_st nlocal = a%ix_max-a%ix_min+1 @@ -526,6 +532,11 @@ contains ix_min = a%ix_min ix_max = a%ix_max + icompy_min = a%icompy_min + icompy_max = a%icompy_max + icompx_min = a%icompx_min + icompx_max = a%icompx_max + ! Work out coordinates of processor call mpi_comm_size(MPI_COMM_HORIZ,nprocs,ierr) call mpi_comm_rank(MPI_COMM_HORIZ,rank,ierr) @@ -552,8 +563,8 @@ contains !$acc kernels !$acc loop collapse(3) do iz=0,nz+1 - do iy=a%icompy_min,a%icompy_max - do ix=a%icompx_min,a%icompx_max + do iy=icompy_min,icompy_max + do ix=icompx_min,icompx_max local_sumt = local_sumt & + za_st(ix,iy,iz)*zb_st(ix,iy,iz) end do @@ -598,6 +609,10 @@ contains else s = global_sumt end if + +#ifdef MNH +!!$ CALL MPPDB_CHECK0D_REAL_MG(s,"scalarprod_mnh") +#endif end subroutine scalarprod_mnh !------------------------------------------------------------------------------- @@ -1105,6 +1120,11 @@ contains Gneighbour_e = (neighbour_e_rank >= 0) Gneighbour_w = (neighbour_w_rank >= 0) ! + requests_ns(:) = MPI_REQUEST_NULL + requests_ew(:) = MPI_REQUEST_NULL + requests_nsT(:) = MPI_REQUEST_NULL + requests_ewT(:) = MPI_REQUEST_NULL + ! #ifdef MNH_GPUDIRECT if (LUseT) then ! -- GitLab