E3SM-Project / scorpio

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

NF_COMPACT not defined by netcdf-fortran 4.4.5 on Summit #523

Closed dqwu closed 10 months ago

dqwu commented 1 year ago

With recent Fortran interface updates, src/flib/spio_netcdf_types.F90 uses NF_COMPACT when NETCDF4 is available:

#ifdef _NETCDF4
#include <netcdf.inc>
  integer, public, parameter :: PIO_CONTIGUOUS = NF_CONTIGUOUS
  integer, public, parameter :: PIO_CHUNKED = NF_CHUNKED
  integer, public, parameter :: PIO_COMPACT = NF_COMPACT
#else
  integer, public, parameter :: PIO_CONTIGUOUS = 0
  integer, public, parameter :: PIO_CHUNKED = 0
  integer, public, parameter :: PIO_COMPACT = 0
#endif

This would cause some E3SM build errors on Summit:

E3SM/externals/scorpio/src/flib/spio_netcdf_types.F90:27:45:
   27 |   integer, public, parameter :: PIO_COMPACT = NF_COMPACT
      |                                             1
Error: Parameter nf_compact at (1) has not been declared or is a variable, which does not reduce to a constant expression

Note, NF_COMPACT is not defined before netcdf-fortran 4.5.3.

On Summit, E3SM uses netcdf-fortran 4.4.5 module: <command name="load">netcdf-fortran/4.4.5</command>

dqwu commented 1 year ago

@jayeshkrishna This issue is also reproducible on anvil where netcdf-fortran 4.4.4 is being used: export NETCDF_FORTRAN_PATH=/gpfs/fs1/software/centos7/spack-latest/opt/spack/linux-centos7-x86_64/intel-20.0.4/netcdf-fortran-4.4.4-eanrh5t

dqwu commented 1 year ago

Also reproducible on chrysalis: export NETCDF_FORTRAN_PATH=/gpfs/fs1/soft/chrysalis/spack/opt/spack/linux-centos8-x86_64/intel-20.0.4/netcdf-fortran-4.4.4-tplolxh