Skip to content

Instantly share code, notes, and snippets.

@zhanwenchen
Last active June 14, 2022 19:58
Show Gist options
  • Save zhanwenchen/2905a62b77a7fb69f36bb08c88906ec4 to your computer and use it in GitHub Desktop.
Save zhanwenchen/2905a62b77a7fb69f36bb08c88906ec4 to your computer and use it in GitHub Desktop.
Build HDF5 Library with Parallel Support on Linux
# https://github.com/HDFGroup/hdf5/blob/hdf5-1_13_1/release_docs/INSTALL_parallel
# https://docs.olcf.ornl.gov/software/python/parallel_h5py.html
# https://www.pism.io/docs/installation/parallel-io-libraries.html
# using ~/local/build/hdf5 as the build directory.
# Install HDF5 1.13.1 with parallel I/O in ~/local/hdf5,
version=1.13.1
prefix=$HOME/local/hdf5
build_dir=~/local/build/hdf5
hdf5_site=https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.13
url=${hdf5_site}/hdf5-${version}/src/hdf5-${version}.tar.gz
mkdir -p ${prefix}
mkdir -p ${build_dir}
pushd ${build_dir}
wget -nc ${url}
tar xzf hdf5-${version}.tar.gz
pushd hdf5-${version}
echo "configure" 2>&1 | tee hdf5_install.log
CC=mpicc CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -w" ./configure \
--enable-parallel \
--enable-shared \
--prefix=${prefix} 2>&1 | tee -a hdf5_install.log
echo "make clean" 2>&1 | tee -a hdf5_install.log
make clean 2>&1 | tee -a hdf5_install.log
echo "make all" 2>&1 | tee -a hdf5_install.log
make all -j8 2>&1 | tee -a hdf5_install.log
echo "make check" 2>&1 | tee -a hdf5_install.log
make check 2>&1 | tee -a hdf5_install.log
echo "make install" 2>&1 | tee -a hdf5_install.log
make install -j8 2>&1 | tee -a hdf5_install.log
echo "make check-install" 2>&1 | tee -a hdf5_install.log
make check-install 2>&1 | tee -a hdf5_install.log
echo "completed" 2>&1 | tee -a hdf5_install.log
popd
popd
MPICC="mpicc -shared" pip install --no-binary=mpi4py mpi4py
CC="mpicc" HDF5_MPI="ON" HDF5_DIR=/home/zhanwen/local/hdf5 pip install --no-binary=h5py h5py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment