From 2a1fc5342e61a472f092a14ab89e62a07955fbbe Mon Sep 17 00:00:00 2001
From: Juan Escobar <juan.escobar@aero.obs-mip.fr>
Date: Mon, 30 Aug 2021 17:07:06 +0200
Subject: [PATCH] Juan 30/08/2021:profiles.f90, get_u_mnh GPU opti -> add loop
 independent

---
 src/ZSOLVER/tensorproductmultigrid_Source/profiles.f90 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ZSOLVER/tensorproductmultigrid_Source/profiles.f90 b/src/ZSOLVER/tensorproductmultigrid_Source/profiles.f90
index e20e0d221..72338e703 100644
--- a/src/ZSOLVER/tensorproductmultigrid_Source/profiles.f90
+++ b/src/ZSOLVER/tensorproductmultigrid_Source/profiles.f90
@@ -138,6 +138,8 @@ private
     integer       , optional, intent(in)    :: KIB,KIE,KIU,KJB,KJE,KJU,KKU
     real(kind=rl) , optional, intent(inout) :: PU(:,:,:)
 
+    real , dimension(:,:,:) , pointer , contiguous :: zu_st
+
     ix_min = u%ix_min
     ix_max = u%ix_max
     iy_min = u%iy_min
@@ -155,13 +157,16 @@ private
              end do
           end do
        else
+          zu_st => u%st
+          !$acc kernels loop independent collapse(3)
           do iz=1,u%grid_param%nz
              do iy=iy_min, iy_max
                 do ix=ix_min, ix_max
-                   PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) =  u%st(ix-ix_min+1,iy-iy_min+1,iz)
+                   PU(IX-ix_min+KIB,IY-iy_min+KJB,IZ) = zu_st(ix-ix_min+1,iy-iy_min+1,iz)
                 end do
              end do
           end do
+          !$acc end kernels
        end if
     END IF
   end subroutine get_u_mnh
-- 
GitLab