ufs-weather-model
ufs-weather-model copied to clipboard
HAFS app can not be build using GNU compiler, syntax error in HYCOM
Description
HAFS app can not be build using GNU compiler, syntax error in HYCOM:
/scratch2/NCEPDEV/fv3-cam/Dusan.Jovic/ufs/multiple_output_grids/ufs-weather-model/HYCOM-interface/HYCOM/mod_archiv.F90:1194:16:
1194 | 'ssh', &
| 1
Error: Different CHARACTER lengths (3/4) in array constructor at (1)
/scratch2/NCEPDEV/fv3-cam/Dusan.Jovic/ufs/multiple_output_grids/ufs-weather-model/HYCOM-interface/HYCOM/mod_archiv.F90:1250:43:
1250 | call export_from_hycom_tiled(util2,cname_exp(k)) !can't use util1
| 1
Error: Function 'cname_exp' at (1) has no IMPLICIT type
make[2]: *** [HYCOM-interface/CMakeFiles/hycom_obj.dir/HYCOM/mod_archiv.F90.o] Error 1
make[2]: *** Waiting for unfinished jobs....
To Reproduce:
What compilers/machines are you seeing this with? GNU compiler on Hera. Give explicit steps to reproduce the behavior.
- load ufs_hera.gnu module
- try to build any HAFS app configuration
- then, oops, look at the bug
On Cheyenne, HYCOM can be built with the following changes. However the build then fails in WW3, with the "type mismatch" error on an MPI_SEND. When WW3 can be built with CMake, we can add the same "fallow-argument-mismatch" for GNU>10 which should allow the HAFS apps to be built w/ GNU.
diff --git a/HYCOM-interface/CMakeLists.txt b/HYCOM-interface/CMakeLists.txt
index 2566905b..bb3b181a 100644
--- a/HYCOM-interface/CMakeLists.txt
+++ b/HYCOM-interface/CMakeLists.txt
@@ -3,6 +3,9 @@ get_filename_component(hycom_dir "${CMAKE_CURRENT_SOURCE_DIR}/HYCOM" ABSOLUTE)
### HYCOM Fortran compiler flags
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "-g -fbacktrace")
+ if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10)
+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz")
+ endif()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Waliasing -fcray-pointer -fconvert=big-endian -ffree-line-length-none -fno-range-check -fbacktrace")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
diff --git a/NUOPC/HYCOM_OceanComp.F90 b/NUOPC/HYCOM_OceanComp.F90
index 41cf915..a6d6bf1 100644
--- a/NUOPC/HYCOM_OceanComp.F90
+++ b/NUOPC/HYCOM_OceanComp.F90
@@ -136,7 +136,6 @@ module HYCOM_Mod
! espc_timer(6): Run Phase export
#endif
real(ESMF_KIND_R8),parameter :: fillValue = 9.99e20_ESMF_KIND_R8
-
!===============================================================================
contains
!===============================================================================
@@ -209,14 +208,14 @@ module HYCOM_Mod
defaultValue="0", convention="NUOPC", purpose="Instance", rc=rc)
if (ESMF_STDERRORCHECK(rc)) return
diagnostic = ESMF_UtilString2Int(value, &
- specialStringList=(/"min","max","bit16","maxplus"/), &
+ specialStringList=(/"min ","max ","bit16 ","maxplus"/), &
specialValueList=(/0,65535,65536,131071/), rc=rc)
if (ESMF_STDERRORCHECK(rc)) return
call ESMF_AttributeGet(model, name="Verbosity", value=value, &
defaultValue="0", convention="NUOPC", purpose="Instance", rc=rc)
if (ESMF_STDERRORCHECK(rc)) return
verbosity = ESMF_UtilString2Int(value, &
- specialStringList=(/"off","low","high","max","bit16","maxplus"/), &
+ specialStringList=(/"off ","low ","high ","max ","bit16 ","maxplus"/), &
specialValueList=(/0,9985,32513,65535,65536,131071/), rc=rc)
if (ESMF_STDERRORCHECK(rc)) return
@@ -854,14 +853,14 @@ module HYCOM_Mod
defaultValue="0", convention="NUOPC", purpose="Instance", rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
diagnostic = ESMF_UtilString2Int(value, &
- specialStringList=(/"min","max","bit16","maxplus"/), &
+ specialStringList=(/"min ","max ","bit16 ","maxplus"/), &
specialValueList=(/0,65535,65536,131071/), rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
call ESMF_AttributeGet(model, name="Verbosity", value=value, &
defaultValue="0", convention="NUOPC", purpose="Instance", rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
verbosity = ESMF_UtilString2Int(value, &
- specialStringList=(/"off","low","high","max","bit16","maxplus"/), &
+ specialStringList=(/"off ","low ","high ","max ","bit16 ","maxplus"/), &
specialValueList=(/0,9985,32513,65535,65536,131071/), rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
@@ -1367,14 +1366,14 @@ module HYCOM_Mod
defaultValue="0", convention="NUOPC", purpose="Instance", rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
diagnostic = ESMF_UtilString2Int(value, &
- specialStringList=(/"min","max","bit16","maxplus"/), &
+ specialStringList=(/"min ","max ","bit16 ","maxplus"/), &
specialValueList=(/0,65535,65536,131071/), rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
call ESMF_AttributeGet(model, name="Verbosity", value=value, &
defaultValue="0", convention="NUOPC", purpose="Instance", rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
verbosity = ESMF_UtilString2Int(value, &
- specialStringList=(/"off","low","high","max","bit16","maxplus"/), &
+ specialStringList=(/"off ","low ","high ","max ","bit16 ","maxplus"/), &
specialValueList=(/0,9985,32513,65535,65536,131071/), rc=rc)
if (ESMF_STDERRORCHECK(rc)) return ! bail out
diff --git a/mod_archiv.F90 b/mod_archiv.F90
index ef4b0af..0f9592e 100644
--- a/mod_archiv.F90
+++ b/mod_archiv.F90
@@ -1187,13 +1187,13 @@
integer, parameter :: numExpFields = 7
character*30, dimension(numExpFields), parameter :: &
cname_exp = (/ &
- 'sst', &
- 'sss', &
- 'ssu', &
- 'ssv', &
- 'ssh', &
+ 'sst ', &
+ 'sss ', &
+ 'ssu ', &
+ 'ssv ', &
+ 'ssh ', &
'ssfi', &
- 'mlt' /)
+ 'mlt ' /)
!
dtime = time
call forday(dtime,yrflag, iyear,jday,ihour)
A more elegant solution is provided via email from @climbfuji , posing the question to Intel regarding GNU compile failure with a line such as attrList=(/"fhzero", "ncld", "nsoil", "imp_physics", "dtp"/), rc=rc)
Comment by Steve Lionel (Ret.) (Blackbelt):
I will also note that you can use:
attrList=(/character(11)::"fhzero", "ncld", "nsoil", "imp_physics", "dtp"/), rc=rc)
This is standard-conforming and does what Intel Fortran does as an extension.
Is there a reason to maintain this as an issue? Will HYCOM ever be built w/ GNU before it is replaced by MOM6?
@BinLiu-NOAA checking to see if you're aware of this issue and if we should maintain it?
@DeniseWorthen, @zach1221 I don't think from HAFS side, we will try to support building HAFS HYCOM coupling with GNU compiler. Besides, in future HAFS upgrades, the plan to is to transition to MOM6 coupling. Meanwhile, even HAFS FV3ATM only moving-nesting configuration currently does not support GNU compiler either.
@DeniseWorthen, @zach1221 I don't think from HAFS side, we will try to support building HAFS HYCOM coupling with GNU compiler. Besides, in future HAFS upgrades, the plan to is to transition to MOM6 coupling. Meanwhile, even HAFS FV3ATM only moving-nesting configuration currently does not support GNU compiler either.
Ok, thank you @BinLiu-NOAA. I will go ahead and close this. @DusanJovic-NOAA if you believe it should be kept open, please let me know.