Skip to content

Instantly share code, notes, and snippets.

@jyalim
Last active February 20, 2024 05:40
Show Gist options
  • Save jyalim/eb944f7d63ae49062361 to your computer and use it in GitHub Desktop.
Save jyalim/eb944f7d63ae49062361 to your computer and use it in GitHub Desktop.
Build HDF5 with Intel Compilers
#!/usr/bin/env bash
# https://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-hdf5-with-intel-compilers
## PREREQS
# 1) szip 2.1
export CC=icc
export CXX=icpc
export FC=ifort
export CFLAGS='-O3 -xHost -ip'
export CXXFLAGS='-O3 -xHost -ip'
export FCFLAGS='-O3 -xHost -ip'
tar -zxvf szip-2.1.tar.gz
cd szip-2.1
./configure --prefix=/usr/local/szip-2.1
make
make check
make install
# 2) zlib 1.2.7
export CC=icc
export CFLAGS='-O3 -xHost -ip'
tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure --prefix=/usr/local/zlib-1.2.7
make
make check
make install
## ENV
export CC=icc
export F9X=mpifort
export FC=mpifort
export CXX=icpc
### BUILD
njobs=$(( $(nproc) / 2 ))
tar -zxvf hdf5-1.8.8.tar.gz
cd hdf5-1.8.8
./configure --prefix=/usr/local/hdf5-1.8.8 --enable-fortran --enable-cxx --enable-hl --enable-shared \
--with-szip=/usr/local/szip-2.1 --with-zlib=/usr/local/zlib-1.2.7 --enable-parallel
make -j $njobs && make -j $njobs check
make -j $njobs install
#### USAGE
# -lhdf5
# #include <hdf5.h>
@jyalim
Copy link
Author

jyalim commented May 12, 2020

You'll need to change the install location by changing the --prefix option accordingly. You also may need to update several of your environment variables (e.g. $LD_LIBRARY_PATH) to point to the local install locations.

@caladoa
Copy link

caladoa commented Oct 5, 2022

You'll need to change the install location by changing the --prefix option accordingly. You also may need to update several of your environment variables (e.g. $LD_LIBRARY_PATH) to point to the local install locations.

I'm a real noob on this... but I think I am having a similar issue. Can you elaborate more on the environment variables?

I am getting an error from missing 'hdf5.mod' even though I think I am pointing my program to the right library. I installed hdf5 v1.8 through brew.

@m-a-saleh
Copy link

could you please replace --with-szip by --with-szlib as it is the flag used by the current version of hdf5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment