E3SM-Project / scorpio

A high-level Parallel I/O Library for structured grid applications
Other
21 stars 16 forks source link

Include version check for NetCDF Fortran library #607

Open dqwu opened 2 months ago

dqwu commented 2 months ago

This requirement has been discussed in E3SM-Project/E3SM#6525.

NetCDF Fortran 4.5.0 or higher is required to support the CDF-5 format and its additional external data types: NC_UBYTE, NC_USHORT, NC_UINT, NC_INT64, and NC_UINT64.

We should also ensure that the following CMake check works:

#===== NetCDF-Fortran =====
if (WITH_NETCDF)
  find_package (NetCDF ${NETCDF_FORTRAN_MIN_VER_REQD} COMPONENTS Fortran)
  if (NetCDF_Fortran_FOUND)
    message(STATUS "NetCDF Fortran library dependencies: ${NetCDF_Fortran_LIBRARIES}")
...

I set NETCDF_FORTRAN_MIN_VER_REQD to 4.8.0 for testing (4.6.0 is installed). The CMake configuration did not fail as expected:

-- Found NetCDF:  (Required is at least version "4.8.0") found components: Fortran 
-- NetCDF Fortran library dependencies: /home/wuda/3rdparty/netcdf/lib/libnetcdff.so
dqwu commented 2 months ago

@jayeshkrishna NetCDF-C and PnetCDF have a similar issue. The CMake configuration does not fail as expected. NetCDF-C

-- Could NOT find NetCDF: Found unsuitable version "4.8.0./*!<", but required is at least "4.9.0" (found /home/wuda/3rdparty/netcdf/lib/libnetcdf.so)
-- Found NetCDF:  (Required is at least version "4.9.0") found components: C 

PnetCDF

-- Could NOT find PnetCDF: Found unsuitable version "1.12.3", but required is at least "1.13.0" (found /home/wuda/3rdparty/pnetcdf/lib/libpnetcdf.a)
-- Found PnetCDF:  (Required is at least version "1.13.0") found components: C 

Maybe we should make CMake configuration abort for all possible failed XXXX_MIN_VER_REQD checks:

# Min versions of libraries required
set (MPE_MIN_VER_REQD "2.4.8")
set (NETCDF_C_MIN_VER_REQD "4.4.0")
set (NETCDF_FORTRAN_MIN_VER_REQD "4.5.0")
set (PNETCDF_MIN_VER_REQD "1.8.1")
set (ADIOS_MIN_VER_REQD "2.9.0")