From 46b3b240915b60445e35e1bb10293c381db046e0 Mon Sep 17 00:00:00 2001
From: Juan Escobar <juan.escobar@aero.obs-mip.fr>
Date: Tue, 17 Aug 2021 12:18:08 +0200
Subject: [PATCH] Juan 17/08/2021:datatypes.f90, add missin acc kernels

---
 .../tensorproductmultigrid_Source/datatypes.f90       | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/ZSOLVER/tensorproductmultigrid_Source/datatypes.f90 b/src/ZSOLVER/tensorproductmultigrid_Source/datatypes.f90
index fb91bcd17..4ff30cd06 100644
--- a/src/ZSOLVER/tensorproductmultigrid_Source/datatypes.f90
+++ b/src/ZSOLVER/tensorproductmultigrid_Source/datatypes.f90
@@ -193,7 +193,9 @@ private
     allocate(phi%st(1-halo_size:nlocal+halo_size, &
                     1-halo_size:nlocal+halo_size, &
                     0:grid_param%nz+1))
+    !$acc kernels
     phi%st(:,:,:) = 0.0_rl
+    !$acc end kernels
     end if
 
   end subroutine create_scalar3d
@@ -224,6 +226,8 @@ private
     integer :: nlocalx, nlocaly, nz
     real(kind=rl) :: vol_h, vol_r, h, tmp
 
+    real , dimension(:,:,:), pointer , contiguous :: zphi_st
+
     if (.not. ( ( power .eq. 1) .or. (power .eq. -1) ) ) then
       call fatalerror("power has to be -1 or 1 when volume-scaling fields")
     end if
@@ -244,7 +248,12 @@ private
     end if
   
     if (LUseO) phi%s (1:nz,1:nlocaly,1:nlocalx) = tmp*phi%s (1:nz,1:nlocaly,1:nlocalx)
-    if (LUseT) phi%st(1:nlocalx,1:nlocaly,1:nz) = tmp*phi%st(1:nlocalx,1:nlocaly,1:nz)
+    if (LUseT) then
+       zphi_st => phi%st
+       !$acc kernels
+       zphi_st(1:nlocalx,1:nlocaly,1:nz) = tmp*zphi_st(1:nlocalx,1:nlocaly,1:nz)
+       !$acc end kernels
+    end if
 
     end if
 
-- 
GitLab