NOAA-EMC / wgrib2

Provides functionality for interacting with, reading, writing, and manipulating GRIB2 files.
27 stars 13 forks source link

MPI dependency when parallel netCDF is used #15

Closed climbfuji closed 4 years ago

climbfuji commented 4 years ago

I am using tag v2.0.8-cmake-v1.0.3 of NCEPLIBS-wgrib2 as part of the NCEPLIBS umbrella build (develop branch). Recently I changed the NCEPLIBS-external build to build HDF5 and netCDF with parallel I/O support. This requires using ${MPI_C_Compiler} instead of ${CMAKE_C_Compiler} for compiling libraries or applications that link against this version of netCDF (same for CXX, Fortran). This works fine for all other NCEPLIBS-* that are shipped with the NCEPLIBS umbrella build, but not for wgrib2.

I therefore temporarily turned off building NCEPLIBS-wgrib2 as part of the NCEPLIBS umbrella build (it is currently built as part of NCEPLIBS-external anyway).

kgerheiser commented 4 years ago

So, what's the problem? Using MPI_Compiler doesn't work for wgrib2 but works for the other libraries?

climbfuji commented 4 years ago

So, what's the problem? Using MPI_Compiler doesn't work for wgrib2 but works for the other libraries?

I am just recording this as an issue so that one of us remembers and makes the update to the NCEPLIBS-wgrib2 CMakeLists.txt. Should be straightforward.

kgerheiser commented 4 years ago

I see now, the same thing applies to UFS_UTILS. I the best solution would be to update FindNetCDF to detect if it's parallel and needs to link to MPI. Otherwise, you have to manually link to MPI every time you link to NetCDF.

Thoughts @aerorahul

Is FindNetCDF smart enough to find out if it's parallel and MPI is required?

kgerheiser commented 4 years ago

In nc-config, there's --has-parallel which I think is what we want, and then run find_package(MPI) from there if that is true.

aerorahul commented 4 years ago

FindNetCDF reports that info.

aerorahul commented 4 years ago

Don't remember the details, but something like NETCDF_PARALLEL