Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake build should check package versions and capabilities #2413

Open
edwardhartnett opened this issue Aug 26, 2024 · 5 comments
Open

cmake build should check package versions and capabilities #2413

edwardhartnett opened this issue Aug 26, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@edwardhartnett
Copy link
Contributor

Description

Recently ufs-weather-model was built on WCOSS2 with a version of netCDF which did not support zstd. This should be checked by the build. Also the CMakeLists.txt requires netcdf-c-4.7.4, but shouldn't that be 4.9.2? Is there a check for the MAPL library? We need to confirm that version is 2.46.3.

All required versions need to be kept up to date, so if MAPL 2.46.4 is one day required, the CMake build must be changed to reflect that.

To Reproduce:

Inspection

Additional context

Everything that can be checked about dependencies should be checked in the cmake build. THis prevents install errors and saves time debugging.

Output

N/A

@edwardhartnett edwardhartnett added the bug Something isn't working label Aug 26, 2024
@DusanJovic-NOAA
Copy link
Collaborator

Most of the libraries that are currently required by ufs-weather-model (this repo, not the subcomponents) are versioned:

$ grep find_package CMakeLists.txt 
    find_package(IFI CONFIG REQUIRED)
    find_package(IFI CONFIG)
find_package(MPI REQUIRED)
  find_package(OpenMP REQUIRED)
find_package(NetCDF 4.7.4 REQUIRED C Fortran)
find_package(ESMF 8.3.0 MODULE REQUIRED)
  find_package(FMS 2022.04 REQUIRED COMPONENTS R4 R8)
  find_package(PIO 2.5.3 REQUIRED COMPONENTS C Fortran)
find_package(bacio 2.4.0 REQUIRED)
find_package(sp 2.3.3 REQUIRED)
find_package(w3emc 2.9.2 REQUIRED)
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter)

Only MPI, OpenMP and IFI are not. If the versions listed here are not the minimum required versions, they should be updated. I am not sure if we really need 4.9.2 version of netcdf or 4.7.4 is sufficient. MAPL is required by GOCART (https://github.com/GEOS-ESM/GOCART/blob/041422934cae1570f2f0e67239d5d89f11c6e1b7/CMakeLists.txt#L70), so please open an issue there.

Regarding the zstd, that's an optional feature and model should be able to use netcdf library without zstd. If we want to check whether a particular netcdf installation has support for zstd, then that in formation should be provided by FindNetCDF module, for example:

diff --git a/Modules/FindNetCDF.cmake b/Modules/FindNetCDF.cmake
index f6a9098..f05ba3c 100644
--- a/Modules/FindNetCDF.cmake
+++ b/Modules/FindNetCDF.cmake
@@ -199,6 +199,15 @@ if(NetCDF_PARALLEL)
   find_package(MPI)
 endif()
 
+## Detect zstd filter
+netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-zstd _val)
+if( _val MATCHES "^(yes)$" )
+  set(NetCDF_ZSTD TRUE CACHE STRING "NetCDF has zstd IO capability." FORCE)
+else()
+  set(NetCDF_ZSTD FALSE CACHE STRING "NetCDF has no zstd IO capability." FORCE)
+endif()
+
+
 ## Find libraries for each component
 set( NetCDF_LIBRARIES )
 foreach( _comp IN LISTS _search_components )

We can then check NetCDF_ZSTD variable. Similar for other filters. Please open CMakeModules issue.

@edwardhartnett
Copy link
Contributor Author

Zstd is not supported in netCDF until 4.9.2. If you want to continue to use 4.7.4 should should add logic to handle the case when the user is using 4.7.4 and asks for zstd.

We have a ticket open to upgrade ESMF to 8.6.1, but the CMake says 8.3.0.

@DusanJovic-NOAA
Copy link
Collaborator

I do not know exactly what minimum version of esmf is currently required by the model, is it 8.6., or maybe 8.5.. We should then update the minimum required version.

@junwang-noaa
Copy link
Collaborator

@edwardhartnett Using "zstd" is a run time choice. The model will throw out an error message and stop the run. Please see:

https://github.com/NOAA-EMC/fv3atm/blob/develop/io/module_write_netcdf.F90#L145

Also the model supports a large community, so the minimum required version is listed in the cmake file. E.g. model will compile and run with netcdf 4.7.4 without options of data compression and parallelization turned on when writing out netcdf files.

@DusanJovic-NOAA
Copy link
Collaborator

I tried to run uncoupled (atm only) model using netcdf 4.7.4 and it works, I just had to and logic around netcdf calls that set compression options. I'll add that in one of my future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@junwang-noaa @edwardhartnett @DusanJovic-NOAA and others