Skip to content

Commit

Permalink
Compile physics/module_sf_mynn.F90 with -O1 instead of -O2 to avoid a…
Browse files Browse the repository at this point in the history
… bug with Intel 18 on hera; add a corresponding note in physics/module_sf_mynn.F90
  • Loading branch information
climbfuji committed Apr 1, 2020
1 parent a6f3ded commit afd6481
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
${CMAKE_CURRENT_SOURCE_DIR}/physics/cu_gf_sh.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_bl_mynn.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNPBL_wrapper.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_sf_mynn.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNSFC_wrapper.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNrad_pre.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_MYNNrad_post.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_mp_thompson_make_number_concentrations.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_SF_JSFC.F90
${CMAKE_CURRENT_SOURCE_DIR}/physics/module_BL_MYJPBL.F90
PROPERTIES COMPILE_FLAGS "-r8 -ftz")

# Reduce optimization for module_sf_mynn.F90 (to avoid an apparent compiler bug with Intel 18 on Hera)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/physics/module_sf_mynn.F90
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_OPT} -O1")
list(APPEND SCHEMES_SFX_OPT ${CMAKE_CURRENT_SOURCE_DIR}/physics/module_sf_mynn.F90)

# Replace -xHost or -xCORE-AVX2 with -xCORE-AVX-I for certain files
set(CMAKE_Fortran_FLAGS_LOPT1 ${CMAKE_Fortran_FLAGS_OPT})
string(REPLACE "-xHOST" "-xCORE-AVX-I"
Expand Down
12 changes: 8 additions & 4 deletions physics/module_sf_mynn.F90
Original file line number Diff line number Diff line change
Expand Up @@ -645,19 +645,19 @@ SUBROUTINE SFCLAY1D_mynn( &
DO I=its,ite
write(0,*)"=== imortant input to mynnsfclayer, i:", i
IF (dry(i)) THEN
write(0,*)"dry=",dry(i)," tsk=", tskin_lnd(i),&
write(0,*)"dry=",dry(i)," pblh=",pblh(i)," tsk=", tskin_lnd(i),&
" tsurf=", tsurf_lnd(i)," qsfc=", qsfc_lnd(i)," znt=", znt_lnd(i),&
" ust=", ust_lnd(i)," snowh=", snowh_lnd(i),"psfcpa=",PSFCPA(i), &
" dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
ENDIF
IF (icy(i)) THEN
write(0,*)"icy=",icy(i)," tsk=", tskin_ice(i),&
write(0,*)"icy=",icy(i)," pblh=",pblh(i)," tsk=", tskin_ice(i),&
" tsurf=", tsurf_ice(i)," qsfc=", qsfc_ice(i)," znt=", znt_ice(i),&
" ust=", ust_ice(i)," snowh=", snowh_ice(i),"psfcpa=",PSFCPA(i), &
" dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
ENDIF
IF (wet(i)) THEN
write(0,*)"wet=",wet(i)," tsk=", tskin_ocn(i),&
write(0,*)"wet=",wet(i)," pblh=",pblh(i)," tsk=", tskin_ocn(i),&
" tsurf=", tsurf_ocn(i)," qsfc=", qsfc_ocn(i)," znt=", znt_ocn(i),&
" ust=", ust_ocn(i)," snowh=", snowh_ocn(i),"psfcpa=",PSFCPA(i), &
" dz=",dz8w1d(i)," qflx=",qflx(i)," hflx=",hflx(i)," hpbl=",pblh(i)
Expand Down Expand Up @@ -813,7 +813,11 @@ SUBROUTINE SFCLAY1D_mynn( &
ENDIF

DO I=its,ite
WSPD(I)=SQRT(U1D(I)*U1D(I)+V1D(I)*V1D(I))
! DH* 20200401 - note. A weird bug in Intel 18 on hera prevents using the
! normal -O2 optimization in REPRO and PROD mode for this file. Not reproducible
! by every user, the bug manifests itself in the resulting wind speed WSPD(I)
! being -99.0 despite the assignments in lines 932 and 933. *DH
WSPD(I)=SQRT(U1D(I)*U1D(I)+V1D(I)*V1D(I))
WSPD_ocn = -99.
WSPD_ice = -99.
WSPD_lnd = -99.
Expand Down

0 comments on commit afd6481

Please sign in to comment.