Skip to content

Commit

Permalink
Merge pull request #1688 from NCAR/ejh_more_summary
Browse files Browse the repository at this point in the history
Add netcdf-4 and netcdf-4 par features to the build summary and to pio_meta.h
  • Loading branch information
edwardhartnett authored Jul 30, 2020
2 parents dfc908e + 3601aea commit 602f71c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 9 deletions.
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,28 @@ find_package (PnetCDF)

SET(STATUS_PNETCDF PnetCDF_C_FOUND)

###
# Check to see if netcdf-4 capability is present in netcdf-c.
###
CHECK_C_SOURCE_COMPILES("
#include <netcdf_meta.h>
#if !NC_HAS_NC4
choke me
#endif
int main() {return 0;}" HAVE_NETCDF4)

###
# Check to see if netcdf-4 parallel I/O capability is present in
# netcdf-c. (Really we should be checking NC_HAS_PARALLEL4, but that
# was only recently introduced, so we will go with NC_HAS_PARALLEL.)
###
CHECK_C_SOURCE_COMPILES("
#include <netcdf_meta.h>
#if !NC_HAS_PARALLEL
choke me
#endif
int main() {return 0;}" HAVE_NETCDF_PAR)

###
# Check to see if szip write capability is present in netcdf-c.
###
Expand All @@ -285,7 +307,7 @@ CHECK_C_SOURCE_COMPILES("
int main() {return 0;}" HAVE_SZIP_WRITE)

###
# Check to see if szip write capability is present in netcdf-c.
# Check to see if parallel filters are supported by HDF5/netcdf-c.
###
CHECK_C_SOURCE_COMPILES("
#include <netcdf_meta.h>
Expand Down Expand Up @@ -339,6 +361,8 @@ is_enabled(USE_SZIP HAS_SZIP_WRITE)
is_enabled(STATUS_PNETCDF HAS_PNETCDF)
is_enabled(HAVE_H5Z_SZIP HAS_SZLIB)
is_enabled(HDF5_HAS_PAR_FILTERS HAS_PAR_FILTERS)
is_enabled(HAVE_NETCDF4 HAS_NETCDF4)
is_enabled(HAVE_NETCDF_PAR HAS_NETCDF4_PAR)

# Generate file from template.
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libpio.settings.in"
Expand Down
26 changes: 23 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -257,29 +257,45 @@ if test x$ac_cv_lib_pnetcdf_ncmpi_create = xyes; then
AC_DEFINE([USE_PNETCDF_VARN_ON_READ], [1], [defined by CMake build])
fi

# Do we have a parallel build of netCDF-4?
# Do we have netCDF-4?
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
[[#if !NC_HAS_NC4
# error
#endif]
])], [have_netcdf4=yes], [have_netcdf4=no])
AC_MSG_CHECKING([whether netCDF provides netCDF/HDF5])
AC_MSG_RESULT([${have_netcdf4}])

# Do we have a parallel build of netCDF-4? (Really we should be
# checking NC_HAS_PARALLEL4, but that was only recently introduced, so
# we will go with NC_HAS_PARALLEL.)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
[[#if !NC_HAS_PARALLEL
# error
#endif]
])], [have_netcdf_par=yes], [have_netcdf_par=no])
AC_MSG_CHECKING([whether netCDF provides parallel I/O for netCDF/HDF5])
AC_MSG_RESULT([${have_netcdf_par}])

# Do we have szip?
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
[[#if !NC_HAS_SZIP_WRITE
# error
#endif]
])], [have_szip_write=yes], [have_szip_write=no])
AC_MSG_CHECKING([whether netCDF provides szip write capability])
AC_MSG_RESULT([${have_szip_write}])

# Do we have parallel filter support?
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "netcdf_meta.h"],
[[#if !NC_HAS_PAR_FILTERS
# error
#endif]
])], [have_par_filters=yes], [have_par_filters=no])
AC_MSG_CHECKING([whether netCDF provides parallel filter support])
AC_MSG_RESULT([${have_par_filters}])

AC_MSG_CHECKING([whether netCDF provides parallel IO])
AC_MSG_RESULT([${have_netcdf_par}])
# Set some build settings for when netcdf-4 is supported.
if test x$have_netcdf_par = xyes; then
AC_DEFINE([_NETCDF4],[1],[Does netCDF library provide netCDF-4 with parallel access])
fi
Expand Down Expand Up @@ -378,6 +394,8 @@ AC_DEFUN([AX_SET_META],[
AX_SET_META([PIO_HAS_SZIP_WRITE],[$have_szip_write],[yes])
AX_SET_META([PIO_HAS_PNETCDF],[$enable_pnetcdf],[yes])
AX_SET_META([PIO_HAS_PAR_FILTERS], [$have_par_filters],[yes])
AX_SET_META([PIO_HAS_NETCDF4], [$have_netcdf4],[yes])
AX_SET_META([PIO_HAS_NETCDF4_PAR], [$have_netcdf_par],[yes])

# Create output variables from various shell variables, for use in
# generating libpio.settings.
Expand All @@ -393,6 +411,8 @@ AC_SUBST(HAS_PNETCDF,[$enable_pnetcdf])
AC_SUBST(HAS_LOGGING, [$enable_logging])
AC_SUBST(HAS_SZIP_WRITE, [$have_szip_write])
AC_SUBST([HAS_PAR_FILTERS], [$have_par_filters])
AC_SUBST([HAS_NETCDF4], [$have_netcdf4])
AC_SUBST([HAS_NETCDF4_PAR], [$have_netcdf_par])

# Create the build summary file.
AC_CONFIG_FILES([libpio.settings
Expand Down
7 changes: 5 additions & 2 deletions libpio.settings.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ FPPFLAGS: @FPPFLAGS@
# Features
--------
PnetCDF Support: @HAS_PNETCDF@
SZIP Write Support: @HAS_SZIP_WRITE@
Parallel Filters: @HAS_PAR_FILTERS@
SZIP Write Support: @HAS_SZIP_WRITE@
Parallel Filters: @HAS_PAR_FILTERS@
NetCDF/HDF5 Support: @HAS_NETCDF4@
NetCDF/HDF5 Par I/O: @HAS_NETCDF4_PAR@

8 changes: 5 additions & 3 deletions src/clib/pio_meta.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
#define PIO_VERSION_PATCH @PIO_VERSION_PATCH@ /*!< pio-c patch version. */
#define PIO_VERSION "@PACKAGE_VERSION@"

#define PIO_HAS_SZIP_WRITE @PIO_HAS_SZIP_WRITE@ /*!< szip write support */
#define PIO_HAS_PNETCDF @PIO_HAS_PNETCDF@ /*!< PnetCDF support. */
#define PIO_HAS_PAR_FILTERS @PIO_HAS_PAR_FILTERS@ /* NetCDF supports parallel I/O with filters. */
#define PIO_HAS_SZIP_WRITE @PIO_HAS_SZIP_WRITE@ /*!< szip write support */
#define PIO_HAS_PNETCDF @PIO_HAS_PNETCDF@ /*!< PnetCDF support. */
#define PIO_HAS_PAR_FILTERS @PIO_HAS_PAR_FILTERS@ /*!< NetCDF supports parallel I/O with filters. */
#define PIO_HAS_NETCDF4 @PIO_HAS_NETCDF4@ /*!< NetCDF-4 supported. */
#define PIO_HAS_NETCDF4_PAR @PIO_HAS_NETCDF4_PAR@ /*!< NetCDF-4 parallel I/O supported. */

#endif

0 comments on commit 602f71c

Please sign in to comment.