From 1ae2591cca8b6bb9597579dc732a4b08f07704ff Mon Sep 17 00:00:00 2001
From: Juan ESCOBAR <juan.escobar@aero.obs-mip.fr>
Date: Fri, 15 Apr 2022 19:04:45 +0200
Subject: [PATCH] Juan 15/04/2022:MNH/tke_eps_sources.f90, Cray GPU Opt/Bug
 bypass, add !dir$ concurrent

---
 src/MNH/tke_eps_sources.f90 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/MNH/tke_eps_sources.f90 b/src/MNH/tke_eps_sources.f90
index b9c038e69..cb75d7da4 100644
--- a/src/MNH/tke_eps_sources.f90
+++ b/src/MNH/tke_eps_sources.f90
@@ -418,7 +418,7 @@ ZA(:,:,:)     = - PTSTEP * XCET * &
 #else
 CALL MZM_DEVICE(ZKEFF, ZTMP1_DEVICE) !Warning: re-used later
 CALL MZM_DEVICE(PRHODJ,ZTMP2_DEVICE) !Warning: re-used later
-!$acc kernels
+!$acc kernels present(ZA)
 #ifndef MNH_BITREP
 ZA(:,:,:)     = - PTSTEP * XCET * ZTMP1_DEVICE(:,:,:) * ZTMP2_DEVICE(:,:,:) / PDZZ(:,:,:)**2
 #else
@@ -544,14 +544,16 @@ end if
 
 if (lbudget_tke) then
   !Store the previous source terms in prtkes before initializing the next one
-  PRTKES(:,:,:) = PRTKES(:,:,:) + PRHODJ(:,:,:) *                                                           &
+   !$acc kernels
+   PRTKES(:,:,:) = PRTKES(:,:,:) + PRHODJ(:,:,:) *                                                           &
                   ( PDP(:,:,:) + PTP(:,:,:)                                                                 &
                     - XCED * SQRT(PTKEM(:,:,:)) / PLEPS(:,:,:) * ( PEXPL*PTKEM(:,:,:) + PIMPL*ZRES(:,:,:) ) )
-
+   !$acc end kernels
   call Budget_store_init( tbudgets(NBUDGET_TKE), 'TR', prtkes(:, :, :) )
 end if
 
 !$acc kernels
+!dir$ concurrent
 PRTKES(:,:,:) = ZRES(:,:,:) * PRHODJ(:,:,:) / PTSTEP -  PRTKESM(:,:,:)
 !$acc end kernels
 !
@@ -566,6 +568,7 @@ if (lbudget_tke) call Budget_store_end( tbudgets(NBUDGET_TKE), 'TR', prtkes(:, :
 !
 !$acc kernels
 #ifndef MNH_BITREP
+!dir$ concurrent
 PRTHLS(:,:,:) = PRTHLS(:,:,:) + XCED * SQRT(PTKEM(:,:,:)) / PLEPS(:,:,:) * &
 #else
 PRTHLS(:,:,:) = PRTHLS(:,:,:) + XCED * BR_POW(PTKEM(:,:,:),0.5) / PLEPS(:,:,:) * &
-- 
GitLab