Use a PPA to install HDF5 and PHDF5 on Travis

This commit is contained in:
Paul Romano 2017-07-10 14:55:16 -05:00
parent e38bc516b7
commit 786bb5bc6c
4 changed files with 20 additions and 39 deletions

View file

@ -13,8 +13,6 @@ addons:
- libmpich-dev
cache:
directories:
- $HOME/hdf5_install
- $HOME/phdf5_install
- $HOME/nndc_hdf5
before_install:
@ -34,11 +32,13 @@ before_install:
- source activate test-environment
# Install GCC, HDF5, PHDF5
- ./tests/travis_install.sh
- sudo add-apt-repository ppa:nschloe/hdf5-backports -y
- sudo apt-get update -q
- sudo apt-get install libhdf5-serial-dev libhdf5-mpich-dev -y
- export FC=gfortran
- export MPI_DIR=/usr
- export PHDF5_DIR=$HOME/phdf5_install
- export HDF5_DIR=$HOME/hdf5_install
- export PHDF5_DIR=/usr
- export HDF5_DIR=/usr
install: true

View file

@ -62,10 +62,12 @@ endif()
# this, we check for the environment variable HDF5_ROOT and if it exists, use it
# to check whether its a parallel version.
if(DEFINED ENV{HDF5_ROOT} AND EXISTS $ENV{HDF5_ROOT}/bin/h5pcc)
set(HDF5_PREFER_PARALLEL TRUE)
else()
set(HDF5_PREFER_PARALLEL FALSE)
if(NOT DEFINED HDF5_PREFER_PARALLEL)
if(DEFINED ENV{HDF5_ROOT} AND EXISTS $ENV{HDF5_ROOT}/bin/h5pcc)
set(HDF5_PREFER_PARALLEL TRUE)
else()
set(HDF5_PREFER_PARALLEL FALSE)
endif()
endif()
find_package(HDF5 COMPONENTS Fortran_HL)

View file

@ -188,6 +188,10 @@ class Test(object):
build_str += "-Dopenmp=OFF "
if self.coverage:
build_str += "-Dcoverage=ON "
if self.phdf5:
build_str += "-DHDF5_PREFER_PARALLEL=ON "
else:
build_str += "-DHDF5_PREFER_PARALLEL=OFF "
self.build_opts = build_str
return self.build_opts
@ -214,6 +218,9 @@ class Test(object):
# Runs cmake when in non-script mode
def run_cmake(self):
build_opts = self.build_opts.split()
self.cmake += build_opts
os.environ['FC'] = self.fc
os.environ['CC'] = self.cc
os.environ['CXX'] = self.cxx
@ -221,10 +228,10 @@ class Test(object):
os.environ['MPI_DIR'] = MPI_DIR
if self.phdf5:
os.environ['HDF5_ROOT'] = PHDF5_DIR
self.cmake.append('-DHDF5_PREFER_PARALLEL=ON')
else:
os.environ['HDF5_ROOT'] = HDF5_DIR
build_opts = self.build_opts.split()
self.cmake += build_opts
self.cmake.append('-DHDF5_PREFER_PARALLEL=OFF')
rc = call(self.cmake)
if rc != 0:
self.success = False

View file

@ -1,28 +0,0 @@
#!/bin/bash
set -ev
# Build PHDF5
if [[ ! -e $HOME/phdf5_install/bin/h5pfc ]]; then
wget -q https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.19/src/hdf5-1.8.19.tar.bz2
tar -xjf hdf5-1.8.19.tar.bz2
mv hdf5-1.8.19 phdf5-1.8.19
cd phdf5-1.8.19
CC=/usr/bin/mpicc FC=/usr/bin/mpif90 \
./configure --prefix=$HOME/phdf5_install -q \
--enable-fortran --enable-fortran2003 --enable-parallel
make -j 2 &> /dev/null
make install &> /dev/null
cd ..
fi
# Build HDF5
if [[ ! -e $HOME/hdf5_install/bin/h5fc ]]; then
tar -xjf hdf5-1.8.19.tar.bz2
cd hdf5-1.8.19
CC=gcc FC=gfortran ./configure --prefix=$HOME/hdf5_install -q \
--enable-fortran --enable-fortran2003
make -j 2 &> /dev/null
make install &> /dev/null
cd ..
fi