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

enable netcdf4 only if NetCDF 4.9.0 and later #134

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions .github/workflows/ubuntu_mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ jobs:
- name: Install PnetCDF
run: |
WORKDIR=$(pwd)
rm -rf pnetcdf-1.12.3.tar.gz pnetcdf-1.12.3
rm -rf pnetcdf-1.12.3.tar.gz pnetcdf-1.12.3 qout
wget -cq https://parallel-netcdf.github.io/Release/pnetcdf-1.12.3.tar.gz
tar -zxf pnetcdf-1.12.3.tar.gz
cd pnetcdf-1.12.3
./configure --prefix=${WORKDIR}/.local/pnc/1.12.3 \
--disable-fortran \
--disable-cxx
make -j 4 install
make -j 4 install > qout 2>&1
cd ..
- name: Install HDF5
if: ${{ success() }}
run: |
WORKDIR=$(pwd)
rm -rf hdf5-1.13.0.tar.gz hdf5-1.13.0
rm -rf hdf5-1.13.0.tar.gz hdf5-1.13.0 qout
wget -cq https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.13/hdf5-1.13.0/src/hdf5-1.13.0.tar.gz
tar -zxf hdf5-1.13.0.tar.gz
cd hdf5-1.13.0
Expand All @@ -60,16 +61,17 @@ jobs:
--disable-tools \
--disable-tests \
CC=mpicc
make -j 4 install
make -j 4 install > qout 2>&1
cd ..
- name: Install NetCDF-C
if: ${{ success() }}
run: |
WORKDIR=$(pwd)
rm -rf v4.8.1.tar.gz netcdf-c-4.8.1
wget -cq https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.8.1.tar.gz
tar -zxf v4.8.1.tar.gz
cd netcdf-c-4.8.1
./configure --prefix=${WORKDIR}/.local/netcdf/4.8.1 \
rm -rf v4.9.0.tar.gz netcdf-c-4.9.0 qout
wget -cq https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.0.tar.gz
tar -zxf v4.9.0.tar.gz
cd netcdf-c-4.9.0
./configure --prefix=${WORKDIR}/.local/netcdf/4.9.0 \
--disable-dap \
--disable-nczarr \
--disable-nczarr-filters \
Expand All @@ -78,12 +80,13 @@ jobs:
CPPFLAGS="-I${WORKDIR}/.local/hdf5/1.13.0/include" \
LDFLAGS="-L${WORKDIR}/.local/hdf5/1.13.0/lib" \
LIBS="-lhdf5"
make -j 4 install
make -j 4 install > qout 2>&1
cd ..
- name: Install ADIOS2
if: ${{ success() }}
run: |
WORKDIR=$(pwd)
rm -rf v2.7.1.tar.gz ADIOS2-2.7.1 adios2_build
rm -rf v2.7.1.tar.gz ADIOS2-2.7.1 adios2_build qout
wget -cq https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.7.1.tar.gz
tar -zxf v2.7.1.tar.gz
mkdir adios2_build
Expand All @@ -104,20 +107,21 @@ jobs:
-DADIOS2_BUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
../ADIOS2-2.7.1
make -j 4
make -j 4 install
make -j 4 install > qout 2>&1
cd ..
- name: Install log VOL
if: ${{ success() }}
run: |
WORKDIR=$(pwd)
rm -rf logvol.1.1.0.tar.gz vol-log-based-logvol.1.1.0
wget -cq https://github.com/DataLib-ECP/vol-log-based/archive/refs/tags/logvol.1.1.0.tar.gz
tar -zxf logvol.1.1.0.tar.gz
cd vol-log-based-logvol.1.1.0
rm -rf logvol.1.2.0.tar.gz vol-log-based-logvol.1.2.0 qout
wget -cq https://github.com/DataLib-ECP/vol-log-based/archive/refs/tags/logvol.1.2.0.tar.gz
tar -zxf logvol.1.2.0.tar.gz
cd vol-log-based-logvol.1.2.0
autoreconf -i
./configure --prefix=${WORKDIR}/.local/logvol/1.1.0 \
./configure --prefix=${WORKDIR}/.local/logvol/1.2.0 \
--with-hdf5=${WORKDIR}/.local/hdf5/1.13.0
make -j 4 install
make -j 4 install > qout 2>&1
cd ..
- name: Build E3SM_IO with PnetCDF only
if: ${{ success() }}
run: |
Expand Down Expand Up @@ -150,7 +154,7 @@ jobs:
WORKDIR=$(pwd)
./configure --with-pnetcdf=${WORKDIR}/.local/pnc/1.12.3 \
--with-hdf5=${WORKDIR}/.local/hdf5/1.13.0 \
--with-logvol=${WORKDIR}/.local/logvol/1.1.0 \
--with-logvol=${WORKDIR}/.local/logvol/1.2.0 \
CC=mpicc CXX=mpicxx \
CFLAGS=-fno-var-tracking-assignments \
CXXFLAGS=-fno-var-tracking-assignments
Expand All @@ -163,7 +167,7 @@ jobs:
run: |
WORKDIR=$(pwd)
./configure --with-pnetcdf=${WORKDIR}/.local/pnc/1.12.3 \
--with-netcdf4=${WORKDIR}/.local/netcdf/4.8.1 \
--with-netcdf4=${WORKDIR}/.local/netcdf/4.9.0 \
CC=mpicc CXX=mpicxx \
CFLAGS=-fno-var-tracking-assignments \
CXXFLAGS=-fno-var-tracking-assignments
Expand All @@ -190,8 +194,8 @@ jobs:
WORKDIR=$(pwd)
./configure --with-pnetcdf=${WORKDIR}/.local/pnc/1.12.3 \
--with-hdf5=${WORKDIR}/.local/hdf5/1.13.0 \
--with-netcdf4=${WORKDIR}/.local/netcdf/4.8.1 \
--with-logvol=${WORKDIR}/.local/logvol/1.1.0 \
--with-netcdf4=${WORKDIR}/.local/netcdf/4.9.0 \
--with-logvol=${WORKDIR}/.local/logvol/1.2.0 \
--with-adios2=${WORKDIR}/.local/adios2/2.7.1 \
CC=mpicc CXX=mpicxx \
CFLAGS=-fno-var-tracking-assignments \
Expand All @@ -201,6 +205,7 @@ jobs:
if: ${{ failure() }}
run: |
cat config.log
cat test.sh.log utils/*.log
- name: Test E3SM_IO all APIs -- parallel runs
if: ${{ success() }}
run: |
Expand All @@ -209,6 +214,6 @@ jobs:
if: ${{ success() }}
run: |
WORKDIR=$(pwd)
make distcheck DISTCHECK_CONFIGURE_FLAGS="--with-pnetcdf=${WORKDIR}/.local/pnc/1.12.3 --with-hdf5=${WORKDIR}/.local/hdf5/1.13.0 --with-netcdf4=${WORKDIR}/.local/netcdf/4.8.1 --with-logvol=${WORKDIR}/.local/logvol/1.1.0 --with-adios2=${WORKDIR}/.local/adios2/2.7.1 CC=mpicc CXX=mpicxx CFLAGS=-fno-var-tracking-assignments CXXFLAGS=-fno-var-tracking-assignments"
make distcheck DISTCHECK_CONFIGURE_FLAGS="--with-pnetcdf=${WORKDIR}/.local/pnc/1.12.3 --with-hdf5=${WORKDIR}/.local/hdf5/1.13.0 --with-netcdf4=${WORKDIR}/.local/netcdf/4.9.0 --with-logvol=${WORKDIR}/.local/logvol/1.2.0 --with-adios2=${WORKDIR}/.local/adios2/2.7.1 CC=mpicc CXX=mpicxx CFLAGS=-fno-var-tracking-assignments CXXFLAGS=-fno-var-tracking-assignments"
make distclean

49 changes: 25 additions & 24 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
+ m4 1.4.18
* MPI C and C++ compilers
+ Configured with a std 11 C++ compiler (supporting constant initializer)
* (Optional) [PnetCDF 1.12.2](https://parallel-netcdf.github.io/Release/pnetcdf-1.12.2.tar.gz)
* (Optional) [PnetCDF 1.12.3](https://parallel-netcdf.github.io/Release/pnetcdf-1.12.3.tar.gz)
* (Optional) [HDF5 1.13.0](https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.13/hdf5-1.13.0/src/hdf5-1.13.0.tar.gz)
+ Configured with parallel I/O support (configured with `--enable-parallel` is required)
* (Optional) [HDF5 Log-based VOL](https://github.com/DataLib-ECP/vol-log-based.git)
+ Experimental software developed as part of the Datalib project
* (Optional) [ADIOS 2.7.1](https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.7.1.tar.gz)
+ Configured with parallel I/O support (cmake with `-DADIOS2_USE_MPI=ON` is required)
* (Optional) [NetCDF-C 4.8.1](https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.8.1.tar.gz)
* (Optional) [NetCDF-C 4.9.0](https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.0.tar.gz)
+ Configured with parallel HDF5 support (i.e. `--enable-netcdf4`)
+ Note currently this option fails to run due to a
[bug](https://github.com/Unidata/netcdf-c/issues/2251) in NetCDF-C.
Expand All @@ -26,12 +26,12 @@
+ Configure PnetCDF with MPI C compiler
+ Run `make install`
+ Example build commands are given below. This example will install
the PnetCDF library under folder `${HOME}/PnetCDF/1.12.2`.
the PnetCDF library under folder `${HOME}/PnetCDF/1.12.3`.
```
% wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.2.tar.gz
% tar -zxf pnetcdf-1.12.2.tar.gz
% cd pnetcdf-1.12.2
% ./configure --prefix=${HOME}/PnetCDF/1.12.2 CC=mpicc
% wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.3.tar.gz
% tar -zxf pnetcdf-1.12.3.tar.gz
% cd pnetcdf-1.12.3
% ./configure --prefix=${HOME}/PnetCDF/1.12.3 CC=mpicc
% make -j 4 install
```
* Build HDF5 with parallel I/O support
Expand All @@ -54,10 +54,10 @@
+ Compile with zlib library to enable metadata compression (--enable-zlib)
+ Example commands are given below.
```
% wget https://github.com/DataLib-ECP/vol-log-based/archive/refs/tags/logvol.1.1.0.tar.gz
% tar -zxf logvol.1.1.0.tar.gz
% cd vol-log-based-logvol.1.1.0
% ./configure --prefix=${HOME}/Log_VOL/1.1.0 --with-hdf5=${HOME}/HDF5/1.13.0 --enable-shared CC=mpicc
% wget https://github.com/DataLib-ECP/vol-log-based/archive/refs/tags/logvol.1.2.0.tar.gz
% tar -zxf logvol.1.2.0.tar.gz
% cd vol-log-based-logvol.1.2.0
% ./configure --prefix=${HOME}/Log_VOL/1.2.0 --with-hdf5=${HOME}/HDF5/1.13.0 --enable-shared CC=mpicc
% make -j 4 install
```
* Build ADIOS with parallel I/O support
Expand All @@ -79,12 +79,12 @@
+ Configure NetCDF-C with parallel HDF5 I/O enabled.
+ Run `make install`
+ Example build commands are given below. This example will install
the NetCDF library under the folder `${HOME}/NetCDF/4.8.1`.
the NetCDF library under the folder `${HOME}/NetCDF/4.9.0`.
```
% wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.8.1.tar.gz
% tar -zxf v4.8.1.tar.gz
% cd netcdf-c-4.8.1
% ./configure --prefix=${HOME}/NetCDF/4.8.1 \
% wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.0.tar.gz
% tar -zxf v4.9.0.tar.gz
% cd netcdf-c-4.9.0
% ./configure --prefix=${HOME}/NetCDF/4.9.0 \
CC=mpicc \
CPPFLAGS=-I${HOME}/HDF5/1.13.0/include \
LDFLAGS=-L${HOME}/HDF5/1.13.0/lib \
Expand Down Expand Up @@ -117,10 +117,11 @@
% git clone https://github.com/Parallel-NetCDF/E3SM-IO.git
% cd E3SM-IO
% autoreconf -i
% ./configure --with-pnetcdf=${HOME}/PnetCDF/1.12.2 \
% ./configure --with-pnetcdf=${HOME}/PnetCDF/1.12.3 \
--with-hdf5=${HOME}/HDF5/1.13.0 \
--with-logvol=${HOME}/Log_VOL/1.1.0 \
--with-logvol=${HOME}/Log_VOL/1.2.0 \
--with-adios2=${HOME}/ADIOS2/2.7.1 \
--with-netcdf4=${HOME}/NetCDF/4.9.0 \
CC=mpicc CXX=mpicxx
% make
```
Expand Down Expand Up @@ -208,13 +209,13 @@

### Current supported APIs (option `-a`) and I/O strategies (option `-x`)
+ Table below lists the supported combinations.
| | pnetcdf | hdf5 | hdf5_log | netcdf4 | adios |
|-----------|:-------:|:----:|:--------:|:-------:|:-----:|
| canonical | yes | yes | no | yes | no |
| log | no | yes | yes | yes* | no |
| blob | yes | yes | no | no | yes |
| | pnetcdf | hdf5 | hdf5_log | netcdf4* | adios |
|-----------|:-------:|:----:|:--------:|:--------:|:-----:|
| canonical | yes | yes | no | yes | no |
| log | no | yes | yes | yes | no |
| blob | yes | yes | no | no | yes |

`*` Requires setting of 2 VOL environment variables. See description below.
`*` NetCDF-C version 4.9.0 or newer is required.

+ **-a pnetcdf -x canonical**
* A single NetCDF file in the classic CDF5 format will be created. All
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endif
if ENABLE_LOGVOL
TESTS_ENVIRONMENT += export ENABLE_LOGVOL=1;
TESTS_ENVIRONMENT += export LOGVOL_LIB_PATH="@LOGVOL_LIB_PATH@";
TESTS_ENVIRONMENT += export H5LDUMP="@H5LDUMP@";
endif

TESTS = test.sh
Expand All @@ -40,7 +41,7 @@ EXTRA_DIST = test.sh \
AUTHORS \
slurm.knl

ptest: $(check_PROGRAMS)
ptest: src/e3sm_io
@echo "==========================================================="
@echo " Parallel testing on 16 MPI processes"
@echo "==========================================================="
Expand Down
63 changes: 53 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ AM_CONDITIONAL(ENABLE_PNC, [test "x$have_pnc" = xyes])
have_hdf5=no
have_multi_dset=no
AC_ARG_WITH([hdf5],
[AS_HELP_STRING([--with-hdf5@<:@=INC,LIB | =DIR@:>@],
[AS_HELP_STRING([--with-hdf5@<:@=INC,LIB | =DIR@:>@],
[Enable HDF5 feature and provide the HDF5 installation path(s):
--with-hdf5=INC,LIB for include and lib paths separated by a comma.
--with-hdf5=DIR for the path containing include/ and lib/ subdirectories.
Expand Down Expand Up @@ -420,7 +420,7 @@ AC_ARG_WITH([netcdf4],
if test -n "$withval"; then
netcdf4_inc="$withval/include"
netcdf4_lib="$withval/lib"
netcdf4_bindir="$NETCDF4_INSTALL/bin"
netcdf4_bindir="$withval/bin"
fi
;;
esac
Expand All @@ -433,6 +433,7 @@ AC_ARG_WITH([netcdf4],
if test "x$netcdf4_config" != x ; then
netcdf4_cflags=`$netcdf4_config --cflags`
netcdf4_lflags=`$netcdf4_config --libs`
netcdf4_version=`$netcdf4_config --version | cut -d' ' -f2 | cut -d'-' -f1`
else
netcdf4_cflags="-I$netcdf4_inc"
netcdf4_lflags="-L$netcdf4_lib"
Expand All @@ -453,17 +454,48 @@ AC_ARG_WITH([netcdf4],
LDFLAGS="$LDFLAGS $netcdf4_lflags"
fi
fi
AC_CHECK_HEADER([netcdf.h], [have_netcdf4=yes], [have_netcdf4=no])
AC_CHECK_HEADERS([netcdf.h netcdf_meta.h], [have_netcdf4=yes], [have_netcdf4=no])
if test "x$have_netcdf4" = xno ; then
AC_MSG_WARN([
-----------------------------------------------------------------------
Missing NetCDF-header files 'netcdf4_c.h' required to build E3SM_IO. Use
configure command-line option --with-netcdf4=/path/to/implementation
to specify the location of NetCDF installation. Disable NetCDF 4 support.
Missing NetCDF-header files 'netcdf.h' or 'netcdf_meta.h' which are
required to build E3SM_IO. Use configure command-line option
--with-netcdf4=/path/to/implementation to specify the location of
NetCDF-4 installation. Disable NetCDF-4 support.
-----------------------------------------------------------------------])
fi

AC_MSG_CHECKING([if NetCDF $netcdf_version is configured with parallel I/O enabled])
if test "x$have_netcdf4" = xyes ; then
AC_MSG_CHECKING([NetCDF-C version])
if test "x$netcdf4_version" = x ; then
nc_version_major=`${EGREP} NC_VERSION_MAJOR $netcdf4_inc/netcdf_meta.h| head -1 | cut -d' ' -f3`
nc_version_minor=`${EGREP} NC_VERSION_MINOR $netcdf4_inc/netcdf_meta.h| head -1 | cut -d' ' -f3`
nc_version_patch=`${EGREP} NC_VERSION_PATCH $netcdf4_inc/netcdf_meta.h| head -1 | cut -d' ' -f3`
netcdf4_version="${nc_version_major}.${nc_version_minor}.${nc_version_patch}"
fi
AC_MSG_RESULT([$netcdf4_version])

dnl Check if NetCDF version is 4.9.0 or later
AC_MSG_CHECKING([whether NetCDF-C version is 4.9.0 or later])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <netcdf_meta.h>
#define VER_NUM (NC_VERSION_MAJOR*1000000 + NC_VERSION_MINOR*1000 + NC_VERSION_PATCH)
#if (VER_NUM < 4009000)
#error NetCDF version is older than 4.9.0
#endif
]])], [netcdf_ge_4_9_0=yes], [netcdf_ge_4_9_0=no])
AC_MSG_RESULT([$netcdf_ge_4_9_0])

if test "x${netcdf_ge_4_9_0}" = xno; then
AC_MSG_ERROR([
------------------------------------------------------------
Supplied NetCDF-4 version is $netcdf4_version, but 4.9.0 or later
is required. Abort.
------------------------------------------------------------])
fi
fi

AC_MSG_CHECKING([if NetCDF-4 is configured with parallel I/O enabled])
if test "x$netcdf4_config" != x ; then
netcdf4_has_par=`$netcdf4_config --has-parallel4`
else
Expand All @@ -474,7 +506,7 @@ AC_ARG_WITH([netcdf4],
AC_MSG_WARN([
------------------------------------------------------------
NetCDF was not built with parallel NetCDF 4 support.
Disable NetCDF4.
Disable NetCDF4.
------------------------------------------------------------])
have_netcdf4 = no
elif test "x$netcdf4_lib" != x ; then
Expand Down Expand Up @@ -503,11 +535,13 @@ AC_ARG_WITH([logvol],
*,*)
logvol_inc="`echo $withval |cut -f1 -d,`"
logvol_lib="`echo $withval |cut -f2 -d, -s`"
logvol_bindir="$logvol_inc/../bin"
;;
*)
if test -n "$withval"; then
logvol_inc="$withval/include"
logvol_lib="$withval/lib"
logvol_bindir="$withval/bin"
fi
;;
esac
Expand Down Expand Up @@ -539,6 +573,15 @@ AC_ARG_WITH([logvol],
if test "x$have_logvol" = xyes ; then
AC_SUBST(LOGVOL_LIB_PATH, [$logvol_lib])
fi
if test "x$logvol_bindir" != x ; then
AC_PATH_PROG([h5ldump],[h5ldump],,[$logvol_bindir])
else
dnl Check h5ldump under $PATH
AC_PATH_PROG([h5ldump],[h5ldump])
fi
if test "x$h5ldump" != x ; then
AC_SUBST(H5LDUMP, [$h5ldump])
fi
])
AM_CONDITIONAL(ENABLE_LOGVOL, [test "x$have_logvol" = xyes])

Expand Down Expand Up @@ -618,9 +661,9 @@ if test "x${have_pnc}" = xno && test "x${have_nc4}" = xno && test "x${have_hdf5}
-----------------------------------------------------------------------
At least one API driver must be enabled.
Use configure command-line option --with-pnetcdf=/path/to/implementation
to specify the location of PnetCDF installation.
to specify the location of PnetCDF installation.
Use configure command-line option --with-netcdf4=/path/to/implementation
to specify the location of NetCDF installation.
to specify the location of NetCDF installation.
Use configure command-line option --with-hdf5=/path/to/implementation
to specify the location of HDF5 installation.
Use configure command-line option --with-adios2=/path/to/implementation
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/e3sm_io_driver_nc4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int e3sm_io_driver_nc4::create (std::string path, MPI_Comm comm, MPI_Info info,
E3SM_IO_TIMER_START (E3SM_IO_TIMER_NC4)
E3SM_IO_TIMER_START (E3SM_IO_TIMER_NC4_OPEN)

err = nc_create_par (path.c_str (), NC_CLOBBER | NC_NETCDF4, comm, info, fid);
err = nc_create_par (path.c_str (), NC_CLOBBER | NC_NETCDF4 | NC_NODIMSCALE_ATTACH, comm, info, fid);
CHECK_NCERR

/* turn off fill mode for the entire file */
Expand Down
Loading