From 8c49800bc5fff6fcc38d51008a654d936e879ea0 Mon Sep 17 00:00:00 2001
From: Juan ESCOBAR <juan.escobar@aero.obs-mip.fr>
Date: Fri, 3 Nov 2023 12:14:29 +0100
Subject: [PATCH] Juan 3/11/2023:MNH/*.f90 , for cce/16.0.0 add present_cr to
 avoid false recurrence on GPU

---
 src/MNH/dyn_sources.f90 | 2 +-
 src/MNH/flat_inv.f90    | 4 ++--
 src/MNH/flat_invz.f90   | 4 ++--
 src/MNH/modeln.f90      | 4 ++--
 src/MNH/qlap.f90        | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/MNH/dyn_sources.f90 b/src/MNH/dyn_sources.f90
index 31d03a9bc..f8ef3c55c 100644
--- a/src/MNH/dyn_sources.f90
+++ b/src/MNH/dyn_sources.f90
@@ -311,7 +311,7 @@ IF ((.NOT.L1D).AND.(.NOT.LCARTESIAN) )  THEN
     CALL MXF_DEVICE(ZRUTT,ZTMP3_DEVICE ) !MXF(ZRUT*PUT)
     CALL MXF_DEVICE(PUT,ZTMP4_DEVICE )   !MXF(PUT)
 
-!$acc kernels present_cr(ZTMP1_DEVICE,ZTMP1_DEVICE,ZTMP1_DEVICE,ZTMP1_DEVICE)
+!$acc kernels present_cr(ZTMP1_DEVICE,ZTMP2_DEVICE,ZTMP3_DEVICE,ZTMP4_DEVICE)
     ZTMP1_DEVICE(:,:,:)=ZTMP1_DEVICE(:,:,:)* ZWORK1(:,:,:)   !MYF(PVT) * ZWORK1
     ZTMP2_DEVICE(:,:,:)=ZTMP2_DEVICE(:,:,:)* ZWORK2(:,:,:)   !MYF(ZRVT*PVT) * ZWORK2
     ZTMP3_DEVICE(:,:,:)=ZTMP3_DEVICE(:,:,:)* ZWORK1(:,:,:)   !MXF(ZRUT*PUT) * ZWORK1
diff --git a/src/MNH/flat_inv.f90 b/src/MNH/flat_inv.f90
index 113dd9902..93b36d357 100644
--- a/src/MNH/flat_inv.f90
+++ b/src/MNH/flat_inv.f90
@@ -403,7 +403,7 @@ END IF
 !
 !*      3.3 2way structure -> xslice structure, + data shift
 !
-!$acc kernels
+!$acc kernels present_cr(ZBAND_X)
 ZBAND_X(:,:,:) = 0.
 !$acc end kernels
 CALL REMAP_2WAY_X_ll(ZY,ZBAND_X,IINFO_ll)
@@ -499,7 +499,7 @@ ENDIF
 !
 ! Transposition Y-> X
 !
-!$acc kernels
+!$acc kernels present_cr(ZBAND_X)
 ZBAND_X(:,:,:) = 0.
 !$acc end kernels
 CALL REMAP_Y_X_ll(ZBAND_YR,ZBAND_X,IINFO_ll)
diff --git a/src/MNH/flat_invz.f90 b/src/MNH/flat_invz.f90
index fe6016718..1790b4c23 100644
--- a/src/MNH/flat_invz.f90
+++ b/src/MNH/flat_invz.f90
@@ -633,7 +633,7 @@ SUBROUTINE FLAT_INVZ(HLBCX,HLBCY,PDXHATM,PDYHATM,PRHOM,PAF,PBF,PCF,   &
 #ifdef MNH_OPENACC
 CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'FLAT_INVZ', 'OpenACC: IAND(NZ_SPLITTING,1) > 0 not tested' )
 #endif
-!$acc kernels
+!$acc kernels present_cr(ZBAND_X)
      ZBAND_X(:,:,:) = 0.0
 !$acc end kernels
      CALL REMAP_2WAY_X_ll(ZY_B,ZBAND_X,IINFO_ll)
@@ -886,7 +886,7 @@ CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'FLAT_INVZ', 'L2D=T not tested' )
      !
      ! Transposition Y-> X
      !
-!$acc kernels
+!$acc kernels present_cr(ZBAND_X)
      ZBAND_X(:,:,:) = 0.
 !$acc end kernels
      CALL REMAP_Y_X_ll(ZBAND_YR,ZBAND_X,IINFO_ll)
diff --git a/src/MNH/modeln.f90 b/src/MNH/modeln.f90
index 6f7863388..cf395801b 100644
--- a/src/MNH/modeln.f90
+++ b/src/MNH/modeln.f90
@@ -1975,7 +1975,7 @@ IF (CCLOUD /= 'NONE' .AND. CELEC == 'NONE') THEN
     XWT_ACT_NUC(:,:,:) = 0.
   END IF
 !
-!$acc kernels
+!$acc kernels present_cr(XRTHS_CLD,XRRS_CLD,XRSVS_CLD)
   XRTHS_CLD(:, :, : )    = XRTHS(:, :, : )
   XRRS_CLD (:, :, :, : ) = XRRS(:, :, :, : )
   IF ( NSV /= 0 ) XRSVS_CLD(:, :, :, : ) = XRSVS(:, :, :, : )
@@ -2052,7 +2052,7 @@ IF (CCLOUD /= 'NONE' .AND. CELEC == 'NONE') THEN
   END IF
 !$acc end data
 
-!$acc kernels
+!$acc kernels present_cr(XRTHS_CLD,XRRS_CLD,XRSVS_CLD)
   XRTHS_CLD(:, :, : )    = XRTHS(:, :, : )    - XRTHS_CLD(:, :, : )
   XRRS_CLD (:, :, :, : ) = XRRS (:, :, :, : ) - XRRS_CLD (:, :, :, : )
   IF ( NSV /= 0 ) XRSVS_CLD(:, :, :, : ) = XRSVS(:, :, :, : ) - XRSVS_CLD(:, :, :, : )
diff --git a/src/MNH/qlap.f90 b/src/MNH/qlap.f90
index 43abc5e9e..200a7677a 100644
--- a/src/MNH/qlap.f90
+++ b/src/MNH/qlap.f90
@@ -313,7 +313,7 @@ IF(.NOT. L2D) THEN
 !  CALL MPPDB_CHECK3D(ZV,'QLAP::ZV/N',PRECISION)
 !
 ELSE
-  !$acc kernels
+  !$acc kernels present_cr(ZV)
   ZV(:,:,:) = 0.
   !$acc end kernels
 ENDIF
-- 
GitLab