From d15eb94f178ae518ecef0833a3757882a99d322f Mon Sep 17 00:00:00 2001 From: Juan ESCOBAR <juan.escobar@aero.obs-mip.fr> Date: Tue, 15 Mar 2022 18:14:42 +0100 Subject: [PATCH] Juan 15/03/2022:tensor/multigrid.f90, Cray OpenACC optimization , discard collapse + do concurrent --- .../multigrid.f90 | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 b/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 index 0b2444808..2fd6bc0b0 100644 --- a/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 +++ b/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 @@ -511,17 +511,16 @@ contains zphifine_st => phifine%st zphicoarse_st => phicoarse%st !$acc kernels +#ifdef MNH_COMPILER_NVHPC !$acc loop independent collapse(3) - do iz=1,nz - do iy=iy_min,iy_max - do ix=ix_min,ix_max +#endif + do concurrent (ix=ix_min:ix_max, iy=iy_min:iy_max, iz=1:nz) zphicoarse_st(ix,iy,iz) = & zphifine_st(2*ix ,2*iy ,iz) + & zphifine_st(2*ix ,2*iy-1,iz) + & zphifine_st(2*ix-1,2*iy ,iz) + & zphifine_st(2*ix-1,2*iy-1,iz) - end do - end do + end do !$acc end kernels endif @@ -849,20 +848,18 @@ contains zphicoarse_st => phicoarse%st !$acc kernels +#ifdef MNH_COMPILER_NVHPC !$acc loop independent collapse(5) - do iz=1,nz - do diy = -1,0 - do dix = -1,0 - do iy=iy_min,iy_max - do ix=ix_min,ix_max - zphifine_st(2*ix+dix,2*iy+diy,iz) = & - zphicoarse_st(ix,iy,iz) + & - rhox*(zphicoarse_st(ix+(2*dix+1),iy,iz) & - - zphicoarse_st(ix,iy,iz)) + & - rhoy*(zphicoarse_st(ix,iy+(2*diy+1),iz) & - - zphicoarse_st(ix,iy,iz)) - end do - end do +#endif + do diy = -1,0 + do dix = -1,0 + DO CONCURRENT (ix=ix_min:ix_max, iy=iy_min:iy_max, iz=1:nz) + zphifine_st(2*ix+dix,2*iy+diy,iz) = & + zphicoarse_st(ix,iy,iz) + & + rhox*(zphicoarse_st(ix+(2*dix+1),iy,iz) & + - zphicoarse_st(ix,iy,iz)) + & + rhoy*(zphicoarse_st(ix,iy+(2*diy+1),iz) & + - zphicoarse_st(ix,iy,iz)) end do end do end do -- GitLab