From 321c3bf2ec0eb72f060aae46895a97c8b3799de9 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Mon, 26 Jun 2023 15:54:02 +0200
Subject: [PATCH] Philippe 26/06/2023: ice4_sedimentation_split: remove a DO
 CONCURRENT because of a reduction in loop (wrong reults with NVHPC 23.5)

(cherry picked from commit ad799fd05abcd71104a2473ca299b1cc32b84344)
---
 src/MNH/ice4_sedimentation_split.f90 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/MNH/ice4_sedimentation_split.f90 b/src/MNH/ice4_sedimentation_split.f90
index 518ba63fb..c5fb8ddea 100644
--- a/src/MNH/ice4_sedimentation_split.f90
+++ b/src/MNH/ice4_sedimentation_split.f90
@@ -748,8 +748,10 @@ DO WHILE (ANY(ZREMAINT>0.))
   ENDIF
 !$acc kernels
   ZMAX_TSTEP(:,:) = ZREMAINT(:,:)
-! acc loop independent private(JI,JJ,JK,JL)
-  !$mnh_do_concurrent( JL = 1 : ISEDIM )
+!PW: does not work with NVHPC 23.5 if !mnh_do_concurrent because it adds a "acc loop independent" and in that case, results are wrong (reduction operation)
+!PW: DO CONCURRENT is probably not correct either (because of the reduction)
+! acc loop independent private(JI,JJ,JK)
+  DO JL = 1, ISEDIM
     JI=I1(JL)
     JJ=I2(JL)
     JK=I3(JL)
@@ -759,7 +761,7 @@ DO WHILE (ANY(ZREMAINT>0.))
                            PRXT(JI, JJ, JK) * PDZZ(JI, JJ, JK) / ZWSED(JI, JJ, JK))
 !acc end atomic
     ENDIF
-  !$mnh_end_do()
+  END DO
   ZREMAINT(:,:) = ZREMAINT(:,:) - ZMAX_TSTEP(:,:)
 !$acc end kernels
 !$acc kernels
-- 
GitLab