From db04f0bad806a452a16de56606dc6359cefc10c9 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Tue, 18 Jan 2022 13:25:30 +0100 Subject: [PATCH] Philippe 18/01/2022: OpenACC: move more Print_msg calls outside of kernels regions --- src/MNH/contrav.f90 | 6 +++++- src/MNH/ice4_warm.f90 | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/MNH/contrav.f90 b/src/MNH/contrav.f90 index d5bec7557..cf8a2c9b2 100644 --- a/src/MNH/contrav.f90 +++ b/src/MNH/contrav.f90 @@ -678,7 +678,6 @@ ELSE !* 3. Compute the vertical contravariant components (general case) ! ------------------------------------ ! -!$acc kernels ! Z1(:,:,:) = 0. ! Z2(:,:,:) = 0. ! @@ -687,6 +686,7 @@ IF (KADV_ORDER == 2 ) THEN call Print_msg( NVERB_WARNING, 'GEN', 'CONTRAV', 'OpenACC: KADV_ORDER=2 and LFLAT=.TRUE. not yet tested' ) #endif ! +!$acc kernels !$acc loop independent collapse(3) do jk = ikb, ike + 1 do jj = 1, iju @@ -717,8 +717,10 @@ IF (KADV_ORDER == 2 ) THEN end do end do end do +!$acc end kernels ! ELSE IF (KADV_ORDER == 4 ) THEN +!$acc kernels ! !!$ IF (NHALO == 1) THEN IF ( GWEST ) THEN @@ -863,10 +865,12 @@ ELSE IF (KADV_ORDER == 4 ) THEN end do end do end do +!$acc end kernels ! ! END IF ! +!$acc kernels PRWCT(:,:,1) = - PRWCT(:,:,3) ! Mirror hypothesis !$acc end kernels !$acc update self(PRWCT) diff --git a/src/MNH/ice4_warm.f90 b/src/MNH/ice4_warm.f90 index b2ed2b7a5..95a0c756c 100644 --- a/src/MNH/ice4_warm.f90 +++ b/src/MNH/ice4_warm.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 1994-2022 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. @@ -202,11 +202,13 @@ DO JL=1, ISIZE PA_RC(JL) = PA_RC(JL) - PRCAUTR(JL) PA_RR(JL) = PA_RR(JL) + PRCAUTR(JL) ENDDO +!$acc end kernels ! ! !* 4.3 compute the accretion of r_c for r_r production: RCACCR ! IF (HSUBG_RC_RR_ACCR=='NONE') THEN +!$acc kernels !CLoud water and rain are diluted over the grid box DO JL=1, ISIZE ZMASK(JL)=MAX(0., -SIGN(1., XRTMIN(2)-PRCT(JL))) * & ! PRCT(:)>XRTMIN(2) @@ -231,8 +233,10 @@ IF (HSUBG_RC_RR_ACCR=='NONE') THEN #endif END WHERE ENDIF +!$acc end kernels ELSEIF (HSUBG_RC_RR_ACCR=='PRFR') THEN +!$acc kernels !Cloud water is concentrated over its fraction with possibly to parts with high and low content as set for autoconversion !Rain is concnetrated over its fraction !Rain in high content area fraction: PHLC_HCF @@ -286,17 +290,21 @@ ELSEIF (HSUBG_RC_RR_ACCR=='PRFR') THEN #endif END WHERE ENDIF +!$acc end kernels ELSE CALL PRINT_MSG(NVERB_FATAL,'GEN','ICE4_WARM','wrong HSUBG_RC_RR_ACCR case') ENDIF +!$acc kernels DO JL=1, ISIZE PA_RC(JL) = PA_RC(JL) - PRCACCR(JL) PA_RR(JL) = PA_RR(JL) + PRCACCR(JL) ENDDO +!$acc end kernels ! !* 4.4 compute the evaporation of r_r: RREVAV ! IF (HSUBG_RR_EVAP=='NONE') THEN +!$acc kernels DO JL=1, ISIZE ZMASK(JL)=MAX(0., -SIGN(1., XRTMIN(3)-PRRT(JL))) * & ! PRRT(:)>XRTMIN(3) &MAX(0., SIGN(1., XRTMIN(2)-PRCT(JL))) * & ! PRCT(:)<=XRTMIN(2) @@ -329,8 +337,10 @@ IF (HSUBG_RR_EVAP=='NONE') THEN #endif END WHERE ENDIF +!$acc end kernels ELSEIF (HSUBG_RR_EVAP=='CLFR' .OR. HSUBG_RR_EVAP=='PRFR') THEN +!$acc kernels !Evaporation in clear sky part !With CLFR, rain is diluted over the grid box !With PRFR, rain is concentrated in its fraction @@ -396,10 +406,12 @@ ELSEIF (HSUBG_RR_EVAP=='CLFR' .OR. HSUBG_RR_EVAP=='PRFR') THEN PRREVAV(:) = PRREVAV(:)*(ZZW4(:)-PCF(:)) END WHERE ENDIF +!$acc end kernels ELSE CALL PRINT_MSG(NVERB_FATAL,'GEN','ICE4_WARM','wrong HSUBG_RR_EVAP case') END IF +!$acc kernels DO JL=1, ISIZE PA_RR(JL) = PA_RR(JL) - PRREVAV(JL) PA_RV(JL) = PA_RV(JL) + PRREVAV(JL) -- GitLab