From 38200f2d044c7fc7d4819c0e3d0243687a730224 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Mon, 24 Jan 2022 13:27:35 +0100 Subject: [PATCH] Philippe 24/01/2022: OpenACC: correct some problems after merge --- src/MNH/ppm.f90 | 1 - src/Rules.LXnvhpc.mk | 2 +- src/ZSOLVER/advection_metsv.f90 | 10 ++++------ src/ZSOLVER/ini_modeln.f90 | 12 +++++++----- src/ZSOLVER/modeln.f90 | 23 ++++++++++++----------- src/ZSOLVER/read_exsegn.f90 | 7 +++++++ 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/MNH/ppm.f90 b/src/MNH/ppm.f90 index 88e8f198b..547eaa952 100644 --- a/src/MNH/ppm.f90 +++ b/src/MNH/ppm.f90 @@ -1286,7 +1286,6 @@ ZFNEG(:,:,:) = PSRC(:,:,:) #endif !$acc end kernels ! -print *,'PW: HLBCY(1)=',HLBCY(1);flush(5) SELECT CASE ( HLBCY(1) ) ! Y direction LBC type: (1) for left side ! !* 2.1 CYCLIC BOUNDARY CONDITIONS IN THE Y DIRECTION diff --git a/src/Rules.LXnvhpc.mk b/src/Rules.LXnvhpc.mk index fe0a23215..4a6ad09cc 100644 --- a/src/Rules.LXnvhpc.mk +++ b/src/Rules.LXnvhpc.mk @@ -22,7 +22,7 @@ TP= -tp=px # #Version of CUDA #(8.0 at least if compute capability >= 6.0) -CUDALEVEL=cuda11.4 +CUDALEVEL=cuda11.5 # #Compute capability of GPU # diff --git a/src/ZSOLVER/advection_metsv.f90 b/src/ZSOLVER/advection_metsv.f90 index b27652e2a..058b0e18f 100644 --- a/src/ZSOLVER/advection_metsv.f90 +++ b/src/ZSOLVER/advection_metsv.f90 @@ -545,12 +545,14 @@ END IF !PW: not necessary: data already on device due to contrav_device !$acc update device(ZRUCPPM,ZRVCPPM,ZRWCPPM) ! acc kernels IF (.NOT. L1D) THEN - !$acc kernels + !$acc kernels ZCFLU(:,:,:) = 0.0 ; ZCFLV(:,:,:) = 0.0 ; ZCFLW(:,:,:) = 0.0 ZCFLU(IIB:IIE,IJB:IJE,:) = ABS(ZRUCPPM(IIB:IIE,IJB:IJE,:) * PTSTEP) ZCFLV(IIB:IIE,IJB:IJE,:) = ABS(ZRVCPPM(IIB:IIE,IJB:IJE,:) * PTSTEP) ZCFLW(IIB:IIE,IJB:IJE,:) = ABS(ZRWCPPM(IIB:IIE,IJB:IJE,:) * PTSTEP) + !$acc end kernels IF (LIBM) THEN + !$acc kernels #ifndef MNH_BITREP ZCFLU(IIB:IIE,IJB:IJE,:) = ZCFLU(IIB:IIE,IJB:IJE,:)*(1.-exp(-(XIBM_LS(IIB:IIE,IJB:IJE,:,2)/& (XRHODJ(IIB:IIE,IJB:IJE,:)/XRHODREF(IIB:IIE,IJB:IJE,:))**(1./3.))**2.)) @@ -569,8 +571,8 @@ IF (.NOT. L1D) THEN WHERE (XIBM_LS(IIB:IIE,IJB:IJE,:,2).GT.(-XIBM_EPSI)) ZCFLU(IIB:IIE,IJB:IJE,:)=0. WHERE (XIBM_LS(IIB:IIE,IJB:IJE,:,3).GT.(-XIBM_EPSI)) ZCFLV(IIB:IIE,IJB:IJE,:)=0. WHERE (XIBM_LS(IIB:IIE,IJB:IJE,:,4).GT.(-XIBM_EPSI)) ZCFLW(IIB:IIE,IJB:IJE,:)=0. + !$acc end kernels ENDIF - !$acc end kernels #ifndef MNH_BITREP IF (.NOT. L2D) THEN !$acc kernels @@ -683,10 +685,6 @@ ZCFLV_MAX = MAX_ll(ZCFLV,IINFO_ll) ZCFLW_MAX = MAX_ll(ZCFLW,IINFO_ll) ZCFL_MAX = MAX_ll(ZCFL,IINFO_ll) #else -CALL GET_INDICE_ll( IIB,IJB,IIE,IJE) -! -IKB=1+JPVEXT -IKE=SIZE(ZCFLU,3)-JPVEXT ! !$acc kernels ZCFLU_MAX = MAXVAL(ZCFLU(IIB:IIE,IJB:IJE,IKB:IKE)) diff --git a/src/ZSOLVER/ini_modeln.f90 b/src/ZSOLVER/ini_modeln.f90 index 4b63fd6b5..56f0d23d9 100644 --- a/src/ZSOLVER/ini_modeln.f90 +++ b/src/ZSOLVER/ini_modeln.f90 @@ -1813,7 +1813,7 @@ gles = lles_mean .or. lles_resolved .or. lles_subgrid .or. lles_updraft & .or. lles_downdraft .or. lles_spectra !Called if budgets are enabled via NAM_BUDGET !or if LES budgets are enabled via NAM_LES (condition on kmi==1 to call it max once) -if ( ( cbutype /= "NONE" .and. nbumod == kmi ) .or. ( gles .and. kmi == 1 ) ) THEN +if ( ( cbutype /= "NONE" .and. nbumod == kmi ) .or. ( gles .and. kmi == 1 ) .or. LCHECK ) THEN call Budget_preallocate() end if @@ -1928,7 +1928,7 @@ CALL READ_FIELD(KMI,TPINIFILE,IIU,IJU,IKU, & NSIZELBXR_ll,NSIZELBYR_ll,NSIZELBXSV_ll,NSIZELBYSV_ll, & XUM,XVM,XWM,XDUM,XDVM,XDWM, & XUT,XVT,XWT,XTHT,XPABST,XTKET,XRTKEMS, & - XRT,XSVT,XZWS,XCIT,XDRYMASST, & + XRT,XSVT,XZWS,XCIT,XDRYMASST,XDRYMASSS, & XSIGS,XSRCT,XCLDFR,XBL_DEPTH,XSBL_DEPTH,XWTHVMF,XPHC,XPHR, & XLSUM,XLSVM,XLSWM,XLSTHM,XLSRVM,XLSZWSM, & XLBXUM,XLBXVM,XLBXWM,XLBXTHM,XLBXTKEM, & @@ -1983,8 +1983,8 @@ CALL INI_LES_n !* 11. INITIALIZE THE SOURCE OF TOTAL DRY MASS Md ! ------------------------------------------ ! -IF((KMI==1).AND.LSTEADYLS) THEN - XDRYMASSS = 0. +IF((KMI==1).AND.LSTEADYLS .AND. (CCONF=='START') ) THEN + XDRYMASSS = 0. END IF ! !------------------------------------------------------------------------------- @@ -2178,6 +2178,7 @@ IF ( KMI > 1) THEN DPTR_XLBYRM=>XLBYRM DPTR_XLBXSVM=>XLBXSVM DPTR_XLBYSVM=>XLBYSVM + IF (CCONF=='START') THEN CALL INI_ONE_WAY_n(NDAD(KMI),KMI, & DPTR_XBMX1,DPTR_XBMX2,DPTR_XBMX3,DPTR_XBMX4,DPTR_XBMY1,DPTR_XBMY2,DPTR_XBMY3,DPTR_XBMY4, & DPTR_XBFX1,DPTR_XBFX2,DPTR_XBFX3,DPTR_XBFX4,DPTR_XBFY1,DPTR_XBFY2,DPTR_XBFY3,DPTR_XBFY4, & @@ -2192,6 +2193,7 @@ IF ( KMI > 1) THEN DPTR_XLBXTHM,DPTR_XLBYTHM, & DPTR_XLBXTKEM,DPTR_XLBYTKEM, & DPTR_XLBXRM,DPTR_XLBYRM,DPTR_XLBXSVM,DPTR_XLBYSVM ) + ENDIF END IF ! ! @@ -2232,7 +2234,7 @@ CALL INI_DYNAMICS(XLON,XLAT,XRHODJ,XTHVREF,XMAP,XZZ,XDXHAT,XDYHAT, & XBFB,XBF_SXP2_YP1_Z, & XAF_ZS,XBF_ZS,XCF_ZS, & XDXATH_ZS,XDYATH_ZS,XRHO_ZS, & - XA_K,XB_K,XC_K,XD_K ) + XA_K,XB_K,XC_K,XD_K ) ! ! !* 16.1 Initialize the XDRAG array diff --git a/src/ZSOLVER/modeln.f90 b/src/ZSOLVER/modeln.f90 index d32a970f6..1de2c71da 100644 --- a/src/ZSOLVER/modeln.f90 +++ b/src/ZSOLVER/modeln.f90 @@ -951,6 +951,14 @@ CALL SECOND_MNH2(ZTIME2) ! XT_BOUND = XT_BOUND + ZTIME2 - ZTIME1 ! +! +! For START/RESTART MPPDB_CHECK use +!IF ( (IMI==1) .AND. (CCONF == "START") .AND. (KTCOUNT == 2) ) THEN +! CALL MPPDB_START_DEBUG() +!ENDIF +!IF ( (IMI==1) .AND. (CCONF == "RESTA") .AND. (KTCOUNT == 1) ) THEN +! CALL MPPDB_START_DEBUG() +!ENDIF !------------------------------------------------------------------------------- !* initializes surface number IF (CSURF=='EXTE') CALL GOTO_SURFEX(IMI) @@ -979,6 +987,10 @@ IF ( nfile_backup_current < NBAK_NUMB ) THEN TFILE_SURFEX => TZBAKFILE CALL GOTO_SURFEX(IMI) CALL WRITE_SURF_ATM_n(YSURF_CUR,'MESONH','ALL',.FALSE.) + IF ( KTCOUNT > 1) THEN + CALL DIAG_SURF_ATM_n(YSURF_CUR,'MESONH') + CALL WRITE_DIAG_SURF_ATM_n(YSURF_CUR,'MESONH','ALL') + END IF NULLIFY(TFILE_SURFEX) END IF ! @@ -1433,17 +1445,6 @@ IF (CDCONV/='NONE') THEN END IF END IF ! -IF ( nfile_backup_current > 0 .AND. nfile_backup_current <= NBAK_NUMB ) THEN - IF ( KTCOUNT == TBACKUPN(nfile_backup_current)%NSTEP ) THEN - IF (CSURF=='EXTE') THEN - CALL GOTO_SURFEX(IMI) - CALL DIAG_SURF_ATM_n(YSURF_CUR,'MESONH') - TFILE_SURFEX => TZBAKFILE - CALL WRITE_DIAG_SURF_ATM_n(YSURF_CUR,'MESONH','ALL') - NULLIFY(TFILE_SURFEX) - END IF - END IF -END IF ! CALL SECOND_MNH2(ZTIME2) ! diff --git a/src/ZSOLVER/read_exsegn.f90 b/src/ZSOLVER/read_exsegn.f90 index 53e7a74fa..536ccf015 100644 --- a/src/ZSOLVER/read_exsegn.f90 +++ b/src/ZSOLVER/read_exsegn.f90 @@ -2150,6 +2150,13 @@ IF ( CRAD /= 'NONE' .AND. CPROGRAM=='MESONH' ) THEN IF(CCONF=='START') THEN CGETRAD='INIT' END IF + IF(CCONF=='RESTA' .AND. (.NOT. LAERO_FT) .AND. (.NOT. LORILAM) & + .AND. (.NOT. LSALT) .AND. (.NOT. LDUST)) THEN + WRITE(UNIT=ILUOUT,FMT=9001) KMI + WRITE(UNIT=ILUOUT,FMT=*) '!!! WARNING !!! FOR REPRODUCTIBILITY BETWEEN START and START+RESTART,' + WRITE(UNIT=ILUOUT,FMT=*) 'YOU MUST USE LAERO_FT=T WITH CAER=TEGE IF CCONF=RESTA IN ALL SEGMENTS' + WRITE(UNIT=ILUOUT,FMT=*) 'TO UPDATE THE OZONE AND AEROSOLS CLIMATOLOGY USED BY THE RADIATION CODE;' + END IF END IF ! ! 3.6 check the initialization of the deep convection scheme -- GitLab