GEOS-ESM / NCEP_Shared

Apache License 2.0
2 stars 1 forks source link

NCEP_bufr cannot build with GCC #16

Open mathomp4 opened 3 years ago

mathomp4 commented 3 years ago

In looking at https://github.com/GEOS-ESM/GEOSgcm/pull/224, it was seen that NCEP_bufr cannot build with GCC. The error is:

[  0%] Building Fortran object src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/moda_mstabs.F.o
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:39:44:

   39 |    CHARACTER*4, BIND(C) :: CBBW(MXMTBB)
      |                                            1
Error: BIND(C) Variable ‘cbbw’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:42:48:

   42 |    CHARACTER*120, BIND(C) :: CBELEM(MXMTBB)
      |                                                1
Error: BIND(C) Variable ‘cbelem’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:41:46:

   41 |    CHARACTER*8, BIND(C) :: CBMNEM(MXMTBB)
      |                                              1
Error: BIND(C) Variable ‘cbmnem’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:37:45:

   37 |    CHARACTER*4, BIND(C) :: CBSCL(MXMTBB)
      |                                             1
Error: BIND(C) Variable ‘cbscl’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:38:47:

   38 |    CHARACTER*12, BIND(C) :: CBSREF(MXMTBB)
      |                                               1
Error: BIND(C) Variable ‘cbsref’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:40:47:

   40 |    CHARACTER*14, BIND(C) :: CBUNIT(MXMTBB)
      |                                               1
Error: BIND(C) Variable ‘cbunit’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:45:46:

   45 |    CHARACTER*8, BIND(C) :: CDMNEM(MXMTBD)
      |                                              1
Error: BIND(C) Variable ‘cdmnem’ at (1) must have length one
/discover/swdev/mathomp4/Models/GEOSgcm-with-bufr-GCC10/GEOSgcm/src/Shared/@NCEP_Shared/NCEP_bufr/moda_mstabs.F:44:47:

   44 |    CHARACTER*120, BIND(C) :: CDSEQ(MXMTBD)
      |                                               1
Error: BIND(C) Variable ‘cdseq’ at (1) must have length one
src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/build.make:1903: recipe for target 'src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/moda_mstabs.F.o' failed
make[3]: *** [src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/moda_mstabs.F.o] Error 1
CMakeFiles/Makefile2:10370: recipe for target 'src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/all' failed
make[2]: *** [src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/all] Error 2
CMakeFiles/Makefile2:10377: recipe for target 'src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/rule' failed
make[1]: *** [src/Shared/@NCEP_Shared/NCEP_bufr_r4i4/CMakeFiles/NCEP_bufr_r4i4.dir/rule] Error 2
Makefile:2554: recipe for target 'NCEP_bufr_r4i4' failed
make: *** [NCEP_bufr_r4i4] Error 2

This is @tclune level thinking needed I think.

That said, I think I can see a cheap fix. I'll test it.

mathomp4 commented 3 years ago

Note, I might "fix" this for GNU by using:

if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
   target_compile_definitions (${this} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:DYNAMIC_ALLOCATION>)
endif ()

where we use the DYNAMIC_ALLOCATION path to let GNU at least build without touching Intel (which might change results).

We would then need someone on the ADAS side (perhaps @gmao-msienkie can suggest someone?) to try out DYNAMIC_ALLOCATION with Intel and see if the results are good.