Skip to content

Commit

Permalink
merged master
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 6, 2020
2 parents 282e338 + eedc46c commit 39d4c79
Show file tree
Hide file tree
Showing 21 changed files with 739 additions and 122 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/c-cpp.yml → .github/workflows/autotools.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ CI
name: autotools

on:
push:
Expand Down Expand Up @@ -31,18 +31,14 @@ jobs:
tar -xzvf pnetcdf-1.11.0.tar.gz
ls -l
pushd pnetcdf-1.11.0
./configure --prefix=/usr --enable-shared
./configure --prefix=/usr --enable-shared --disable-cxx
make
sudo make install
popd
- name: autoreconf
run: autoreconf -i
- name: configure
run: ./configure
- name: make
run: make
run: ./configure --enable-fortran --enable-docs
- name: make check
run: make check
- name: make distcheck
run: make distcheck
run: make -j check
44 changes: 44 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: cmake

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

env:
CC: mpicc
FC: mpifort
CPPFLAGS: "-I/usr/include -I/usr/local/include"

steps:
- uses: actions/checkout@v2
- name: Installs
run: |
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev
- name: pnetcdf build
run: |
wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz
tar -xzvf pnetcdf-1.12.1.tar.gz
ls -l
pushd pnetcdf-1.12.1
./configure --prefix=/usr --enable-shared --disable-cxx
make
sudo make install
popd
- name: cmake build
run: |
find /usr -name libnetcdf.so
mkdir build
cd build
cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/include -DCMAKE_PREFIX_PATH=/usr -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off ..
make VERBOSE=1
make tests VERBOSE=1
ctest -VV
47 changes: 47 additions & 0 deletions .github/workflows/strict_autotools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: strict_autotools

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

env:
CC: mpicc
FC: mpifort
CPPFLAGS: "-I/usr/include -I/usr/local/include"

steps:
- uses: actions/checkout@v2
- name: Installs
run: |
sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev
- name: pnetcdf build
run: |
wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz
tar -xzvf pnetcdf-1.12.1.tar.gz
ls -l
pushd pnetcdf-1.12.1
./configure --prefix=/usr --enable-shared --disable-cxx
make
sudo make install
popd
- name: autoreconf
run: autoreconf -i
- name: configure
run: |
export CFLAGS="-std=c99 -fsanitize=address -fno-omit-frame-pointer -Werror"
export FFLAGS="-fsanitize=address -fno-omit-frame-pointer -Werror"
export FCFLAGS="-fsanitize=address -fno-omit-frame-pointer -Werror"
./configure
- name: make -j distcheck
run: |
export DISTCHECK_CONFIGURE_FLAGS="--enable-fortran"
make -j distcheck
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ before_script:
- export CC=mpicc
- export FC=mpif90
- export CPPFLAGS='-I/usr/include'
- wget https://parallel-netcdf.github.io/Release/pnetcdf-1.11.0.tar.gz
- tar -xzvf pnetcdf-1.11.0.tar.gz
- ls -l
- pushd pnetcdf-1.11.0
- ./configure --prefix=/usr --enable-shared
- wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz
- tar -xzvf pnetcdf-1.12.1.tar.gz
- pushd pnetcdf-1.12.1
- ./configure --prefix=/usr --enable-shared --disable-cxx
- make
- sudo make install
- popd
Expand All @@ -38,7 +37,7 @@ env:
- CPPFLAGS='-I/usr/include'
- CFLAGS='-std=c99'
- LDFLAGS='-L/usr/lib'

script:
- autoreconf -i
- export CFLAGS='-std=c99 -fsanitize=address -fno-omit-frame-pointer -Werror'
Expand All @@ -54,4 +53,4 @@ script:
- cmake -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off ..
- make VERBOSE=1
- make tests VERBOSE=1
- make test VERBOSE=1
- ctest -VV
36 changes: 29 additions & 7 deletions 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 @@ -327,12 +349,10 @@ SET(host_os "${osrel}")
SET(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
SET(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")

SET(CC_VERSION "${CMAKE_C_COMPILER}")

# Build *FLAGS for libpio.settings.
SET(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(CC_VERSION "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
SET(FC_VERSION "${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}")
# Build *FLAGS for libpio.settings. (CFLAGS, CPPFLAGS, FFLAGS promoted from src)
SET(LDFLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}")

is_disabled(BUILD_SHARED_LIBS enable_static)
is_enabled(BUILD_SHARED_LIBS enable_shared)
Expand All @@ -341,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
56 changes: 50 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,35 @@ else
fi
done
fi

if test -n "$cc_version_info"; then
CC_VERSION="$CC_VERSION ( $cc_version_info)"
fi

# Find and learn about the Fortran compiler.
AC_PROG_FC

# Compiler with version information. This consists of the full path
# name of the compiler and the reported version number.
AC_SUBST([FC_VERSION])
# Strip anything that looks like a flag off of $FC
FC_NOFLAGS=`echo $FC | sed 's/ -.*//'`

if `echo $FC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
FC_VERSION="$FC"
else
FC_VERSION="$FC";
for x in `echo $PATH | sed -e 's/:/ /g'`; do
if test -x $x/$FC_NOFLAGS; then
FC_VERSION="$x/$FC"
break
fi
done
fi
if test -n "$fc_version_info"; then
FC_VERSION="$FC_VERSION ( $fc_version_info)"
fi

# Always use malloc in autotools builds.
AC_DEFINE([PIO_USE_MALLOC], [1], [use malloc for memory])

Expand Down Expand Up @@ -185,6 +207,7 @@ if test -z "$DOXYGEN" -a "x$enable_docs" = xyes; then
AC_MSG_ERROR([Doxygen not found but --enable-docs used.])
fi

AC_MSG_NOTICE([processing doxyfile])
# If building docs, process Doxyfile.in into Doxyfile.
if test "x$enable_docs" = xyes; then
AC_SUBST([CMAKE_CURRENT_SOURCE_DIR], ["."])
Expand All @@ -201,6 +224,7 @@ if test "x$enable_docs" = xyes; then
AC_CONFIG_FILES([doc/Doxyfile])
fi

AC_MSG_NOTICE([setting flags])
# NetCDF (at least classic) is required for PIO to build.
AC_DEFINE([_NETCDF], [1], [netCDF classic library available])

Expand Down Expand Up @@ -235,29 +259,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 @@ -356,21 +396,25 @@ 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.
AC_SUBST([enable_shared])
AC_SUBST([enable_static])
AC_SUBST([CFLAGS])
AC_SUBST([CPPFLAGS])
AC_SUBST([FFLAGS])
AC_SUBST([FCFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([FPPFLAGS]) # ignored by autotools
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
11 changes: 9 additions & 2 deletions libpio.settings.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ Shared Library: @enable_shared@
Static Library: @enable_static@
Extra libraries: @LIBS@

Fortran Compiler: @FC_VERSION@
FFLAGS: @FFLAGS@
FCFLAGS: @FCFLAGS@
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@

6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ endif ()

# Build the C library
add_subdirectory (clib)
set(CFLAGS ${CFLAGS} PARENT_SCOPE)
set(CPPFLAGS ${CPPFLAGS} PARENT_SCOPE)


# Build the Fortran library
if (PIO_ENABLE_FORTRAN)
add_subdirectory (flib)
set(FFLAGS ${FFLAGS} PARENT_SCOPE)
set(FCFLAGS ${FCFLAGS} PARENT_SCOPE)
set(FPPFLAGS ${FPPFLAGS} PARENT_SCOPE)
endif ()
Loading

0 comments on commit 39d4c79

Please sign in to comment.