From 3753abe84779746bf9eb04e22a8501796e812b17 Mon Sep 17 00:00:00 2001
From: ESCOBAR Juan <escj@nuwa>
Date: Thu, 17 Mar 2022 10:49:00 +0100
Subject: [PATCH] Juan 17/03/2022:Bypass SegFault/nvhpc/22.2, move mppdb_check
 & split do concurrent on PLM K bound

---
 src/ZSOLVER/turb.f90 | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/ZSOLVER/turb.f90 b/src/ZSOLVER/turb.f90
index 8fa13802e..5ca0c9bd9 100644
--- a/src/ZSOLVER/turb.f90
+++ b/src/ZSOLVER/turb.f90
@@ -1802,14 +1802,15 @@ real, dimension(:,:,:), pointer , contiguous :: zdrvsatdt
 !
 !-------------------------------------------------------------------------------
 !JE: bug: nvhpc 22.2 compiler segfault if PRT/PPABST not in present list !
-!$acc data present( PT, PEXN, PCP, PLOCPEXN, PAMOIST, PATHETA, PPABST, PRT )
 
-  if ( mppdb_initialized ) then
-    !Check all in arrays
-    call Mppdb_check( pt,   "Compute_function_thermo beg:pt"   )
-    call Mppdb_check( pexn, "Compute_function_thermo beg:pexn" )
-    call Mppdb_check( pcp,  "Compute_function_thermo beg:pcp"  )
-  end if
+if ( mppdb_initialized ) then
+   !Check all in arrays
+   call Mppdb_check( pt,   "Compute_function_thermo beg:pt"   )
+   call Mppdb_check( pexn, "Compute_function_thermo beg:pexn" )
+   call Mppdb_check( pcp,  "Compute_function_thermo beg:pcp"  )
+end if
+
+!$acc data present( PT, PEXN, PCP, PLOCPEXN, PAMOIST, PATHETA, PPABST, PRT )
 
 #ifndef MNH_OPENACC  
   allocate( zrvsat   ( size( pexn, 1 ), size( pexn, 2 ), size( pexn, 3 ) ) )
@@ -2298,6 +2299,8 @@ END IF
 !$acc kernels
 DO CONCURRENT(JI=1:JIU , JJ=1:JJU )
    PLM(JI,JJ,KKA) = PLM(JI,JJ,KKB  )
+END DO
+DO CONCURRENT(JI=1:JIU , JJ=1:JJU )
    PLM(JI,JJ,KKU  ) = PLM(JI,JJ,KKE)
 END DO
 !$acc end kernels
-- 
GitLab