sit/install_hdf5_imager.sh

106 lines
2.7 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
. /etc/profile.d/module.sh
TARFILE="hdf5-$1-patch1.tar.bz2"
EXTRDIR="hdf5-$1-patch1"
VERSION="$1"
GNUVERSION="$2"
MPIVERSION="$3"
INSTALLDIR="/opt/tools/hdf5"
MODULEDIR="/opt/tools/hdf5/modulefiles"
MODULEFILE="$VERSION-openmpi-$MPIVERSION-gnu-$GNUVERSION"
if [ "$1" = "" -o "$2" = "" -o "$3" = "" ]; then
echo "error: missing version number" 1>&2
exit 1
fi
if [ ! -e "$TARFILE" ]; then
echo "error: file '$TARFILE' not found" 1>&2
exit 2
fi
if [ ! -e "$EXTRDIR" ]; then
mkdir -p "$EXTRDIR"
tar --bzip2 -xvf hdf5-1.8.15-patch1.tar.bz2
#tar --bzip2 -xvf "$EXTRDIR" -f "$TARFILE"
fi
cd "$EXTRDIR" || exit 1
############################################################################
## installation
umask 002
module load compiler/gnu/$GNUVERSION
module load mpi/openmpi/$MPIVERSION-gnu-$GNUVERSION
module list 2> ../mod_gnu
export > ../gnu_env
CC=mpicc FC=mpif90 CXX=mpicxx ./configure --with-zlib=/opt/tools/zlib/1.2.8 --prefix=/sw/laki-SL6x/hlrs/tools/hdf5/$VERSION-openmpi-$MPIVERSION-gnu-$GNUVERSION/ --enable-parallel --enable-fortran --enable-fortran2003
##configure: error: --enable-cxx and --enable-parallel flags are incompatible.
make
make install
make installcheck > ../installcheck.log
make clean
cd ..
rm -rf "$EXTRDIR"
echo "ende installation"
#########################################################################
##########################MODULEFILES####################################
cd "$MODULEDIR" || exit 1
cat >"$MODULEFILE" <<EOF
#%Module
#
# Module: tools/hdf5/$MODULEFILE
#
set version $VERSION-openmpi-$MPIVERSION-gnu-$GNUVERSION
set base $INSTALLDIR/\$version
set compiler gnu
set compversion $GNUVERSION
set mpipath mpi/openmpi/$MPIVERSION-gnu-$GNUVERSION
prepend-path CPATH \$base/include
prepend-path PATH \$base/bin
prepend-path LD_LIBRARY_PATH \$base/lib
append-path INCLUDE \$base/include
append-path MANPATH \$base/share/man
conflict tools/hdf5
module-whatis "HDF5 (Hierarchical Data Format) version \$version"
proc ModulesHelp { } {
global version base
puts stderr ""
puts stderr "HDF5 (Hierarchical Data Format) version \$version"
puts stderr ""
}
if { [module-info mode] == "load"
|| [module-info mode] == "show"
|| [module-info mode] == "display" } {
if { ! [is-loaded compiler/\$compiler/\$compversion] } {
if { [is-loaded compiler/\$compiler] } {
module unload compiler/\$compiler
}
module load compiler/\$compiler/\$compversion
}
if { ! [is-loaded \$mpipath] } {
if { [is-loaded mpi/openmpi] } {
module unload mpi/openmpi
}
module load \$mpipath
}
}
EOF