noaa-ocs-modeling / CoastalApp

CoastalApp will be deprecated. Please switch to https://github.com/oceanmodeling/ufs-coastal . CoastalApp is a NUOPC application implemented following UFS best practices to couple coastal ocean models and other domains (Sea Ice, Atmosphere, Wave, Inland Hydrology, ...)
https://github.com/oceanmodeling/ufs-coastal
Creative Commons Zero v1.0 Universal
13 stars 32 forks source link

Separate build infrastructure for netcdf-c and netcdf-fortran #34

Open platipodium opened 3 years ago

platipodium commented 3 years ago

The current build infrastructure considers only unified C/Fortran netcdf paths

PlatformFuncs:              export NETCDF="${_var_val}"
PlatformFuncs:              export NETCDFHOME="${_var_val}"
PlatformFuncs:              export NETCDF_DIR="${_var_val}"
PlatformFuncs:              export NETCDF_PATH="${_var_val}"
PlatformFuncs:              export NETCDF_ROOT="${_var_val}"

On many systems, these are located, however in different directories, such that we would need NETCDF_C_XXXX and NETCDF_FORTRAN_XXXX variables. This currently prevents deploying the system via simple modifications to modulefiles/env_module* to system having a separate C/Fortran netcdf interface.

platipodium commented 3 years ago

In NEMS, NETCDF vars are only used in one place

src/conf/configure.nems:NETCDF_INC   = -I$(NETCDF_INCDIR)
src/conf/configure.nems:NETCDF_LIB   = -L$(NETCDF_LIBDIR) -lnetcdf
src/conf/configure.nems:               $(NETCDF_LIB) \
src/conf/configure.nems:               $(NETCDF_LIB)  \

opening up the possibility to manipulate NETCDF_INCDIR and NETCDF_LIBDIR` to include the fortran parts.

A generic workaround is then something like the following:

export NETCDF_INCDIR="$(nc-config --includedir) -I$(nf-config --includedir)"
export NETCDF_LIBDIR="$(nc-config --prefix)/lib $(nf-config --flibs)"