From 5fc70223a9a1eff509c1b0f578fc640636256840 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Mon, 22 Aug 2022 14:00:11 +0200
Subject: [PATCH] Philippe 22/08/2022: OpenACC: move kernels directive inside
 condition (workaround problem with NVHPC 22.7 compiler)

---
 src/MNH/rain_ice_red.f90 | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/MNH/rain_ice_red.f90 b/src/MNH/rain_ice_red.f90
index 0ee449851..4e1030233 100644
--- a/src/MNH/rain_ice_red.f90
+++ b/src/MNH/rain_ice_red.f90
@@ -1844,11 +1844,18 @@ DO WHILE(ANY(ZTIME(:)<PTSTEP)) ! Loop to *really* compute tendencies
       ZRGT(JL)=ZRGT(JL)+ZA_RG(JL)*ZMAXTIME(JL)+ZB_RG(JL)
       ZCIT(JL)=ZCIT(JL) * MAX(0., -SIGN(1., -ZRIT(JL))) ! WHERE(ZRIT(:)==0.) ZCIT(:) = 0.
     ENDDO
-    IF(KRR==7) ZRHT(:)=ZRHT(:)+ZA_RH(:)*ZMAXTIME(:)+ZB_RH(:)
+!$acc end kernels
+    IF(KRR==7) THEN
+!$acc kernels
+      ZRHT(:)=ZRHT(:)+ZA_RH(:)*ZMAXTIME(:)+ZB_RH(:)
+!$acc end kernels
+    END IF
+! !$acc end kernels
     !
     !***       4.4 Mixing ratio change due to each process
     !
     IF(LBU_ENABLE) THEN
+!$acc kernels
       ZTOT_RVHENI(:)= ZTOT_RVHENI(:) +ZRVHENI_MR(:)
       ZTOT_RCHONI(:)= ZTOT_RCHONI(:) +ZRCHONI(:) *ZMAXTIME(:)
       ZTOT_RRHONG(:)= ZTOT_RRHONG(:) +ZRRHONG_MR(:)
@@ -1894,11 +1901,13 @@ DO WHILE(ANY(ZTIME(:)<PTSTEP)) ! Loop to *really* compute tendencies
       ZTOT_RHMLTR(:)= ZTOT_RHMLTR(:) +ZRHMLTR(:) *ZMAXTIME(:)
       ZTOT_RIMLTC(:)= ZTOT_RIMLTC(:) +ZRIMLTC_MR(:)
       ZTOT_RCBERI(:)= ZTOT_RCBERI(:) +ZRCBERI(:) *ZMAXTIME(:)
+!$acc end kernels
     ENDIF
     !
     !***       4.5 Next loop
     !
     GSOFT=.TRUE. ! We try to adjust tendencies (inner while loop)
+!$acc kernels
     ZTIME(:)=ZTIME(:)+ZMAXTIME(:)
 !$acc end kernels
 !$acc update self(ZCOMPUTE)
-- 
GitLab