2021-04-01 13:49:53 +02:00
|
|
|
#!/usr/bin/env bash
|
2021-04-15 18:13:26 +02:00
|
|
|
unset THRESHOLD
|
2021-05-21 11:54:57 +02:00
|
|
|
unset MKL
|
2021-04-01 13:49:53 +02:00
|
|
|
ENV=$1
|
|
|
|
|
2021-06-10 08:46:40 +02:00
|
|
|
echo
|
|
|
|
echo "Sherman-Morrison-Woodbury parameters"
|
|
|
|
echo "------------------------------------"
|
|
|
|
|
2021-04-09 17:21:31 +02:00
|
|
|
## Set Sherman-Morrison root dir
|
2021-04-01 13:49:53 +02:00
|
|
|
PWD=$(pwd)
|
|
|
|
SRCDIR=$(dirname $BASH_SOURCE)
|
|
|
|
case $SRCDIR in
|
2021-04-09 17:21:31 +02:00
|
|
|
/*) SMROOT=$SRCDIR ;;
|
|
|
|
*)
|
|
|
|
if [[ $SRCDIR = . ]]
|
2021-04-06 16:17:42 +02:00
|
|
|
then
|
|
|
|
SMROOT=$PWD
|
|
|
|
else
|
|
|
|
SMROOT=$PWD/$SRCDIR
|
|
|
|
fi
|
|
|
|
;;
|
2021-04-01 13:49:53 +02:00
|
|
|
esac
|
|
|
|
export SMROOT
|
|
|
|
|
2021-04-09 17:21:31 +02:00
|
|
|
## Set environment for hdf5-tools and Makefile
|
2021-04-01 13:49:53 +02:00
|
|
|
case $ENV in
|
|
|
|
intel)
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "* SM build environment set to 'intel'"
|
2021-07-21 11:48:32 +02:00
|
|
|
export HDF5_CXX=icpc
|
|
|
|
export HDF5_CXXLINKER=icpc
|
|
|
|
export HDF5_CLINKER=icpc
|
2021-04-01 13:49:53 +02:00
|
|
|
export ENV=INTEL
|
|
|
|
;;
|
|
|
|
llvm)
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "* SM build environment set to 'llvm'"
|
2021-04-01 13:49:53 +02:00
|
|
|
export HDF5_CXX=clang++
|
|
|
|
export HDF5_CXXLINKER=clang++
|
2021-07-15 17:56:33 +02:00
|
|
|
export HDF5_CLINKER=clang++
|
2021-04-01 13:49:53 +02:00
|
|
|
export ENV=LLVM
|
|
|
|
;;
|
2021-04-14 11:42:45 +02:00
|
|
|
vfc)
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "* SM build environment set to 'vfc'"
|
2021-04-14 11:42:45 +02:00
|
|
|
export HDF5_CXX=clang++
|
|
|
|
export HDF5_CXXLINKER=clang++
|
2021-07-15 17:56:33 +02:00
|
|
|
export HDF5_CLINKER=clang++
|
2021-04-14 11:42:45 +02:00
|
|
|
export ENV=LLVM
|
|
|
|
export VFC_BACKENDS="libinterflop_ieee.so --count-op"
|
|
|
|
;;
|
2021-04-01 13:49:53 +02:00
|
|
|
gnu)
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "* SM build environment set to 'gnu'"
|
2021-04-01 13:49:53 +02:00
|
|
|
export HDF5_CXX=g++
|
|
|
|
export HDF5_CXXLINKER=g++
|
2021-07-15 17:56:33 +02:00
|
|
|
export HDF5_CLINKER=g++
|
2021-04-01 13:49:53 +02:00
|
|
|
export ENV=GNU
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown environment descriptor given."
|
2021-04-14 15:32:54 +02:00
|
|
|
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu}"
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [mkl]"
|
2021-05-07 17:11:04 +02:00
|
|
|
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [threshold]"
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [mkl] [threshold]"
|
|
|
|
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [threshold] [mkl]"
|
2021-04-01 13:49:53 +02:00
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-04-09 17:21:31 +02:00
|
|
|
## Export path, but only once
|
2021-04-06 16:17:42 +02:00
|
|
|
if [[ -z $SMVARS ]]
|
2021-04-01 13:49:53 +02:00
|
|
|
then
|
|
|
|
export PATH=$SMROOT/bin:$PATH
|
|
|
|
export SMVARS=true
|
|
|
|
fi
|
2021-04-15 18:13:26 +02:00
|
|
|
|
2021-05-21 11:54:57 +02:00
|
|
|
## Argument parsing
|
|
|
|
if [[ $# -eq 1 ]]
|
2021-04-15 18:13:26 +02:00
|
|
|
then
|
2021-05-21 11:54:57 +02:00
|
|
|
echo "* Default threshold of '1e-3' will be used in next build."
|
2021-04-15 18:13:26 +02:00
|
|
|
fi
|
2021-05-21 11:54:57 +02:00
|
|
|
if [[ $# -eq 2 ]]
|
|
|
|
then
|
|
|
|
if [[ $2 == mkl ]]
|
|
|
|
then
|
|
|
|
echo "* oneMKL-dependent parts of the code are enable in next build."
|
|
|
|
echo "* Default threshold of '1e-3' will be used in next build."
|
|
|
|
export MKL="-DMKL"
|
|
|
|
else
|
|
|
|
echo "* Threshold of '$2' will be used in next build."
|
|
|
|
export THRESHOLD="-DTHRESHOLD=$2"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ $# -eq 3 ]]
|
|
|
|
then
|
|
|
|
echo "* oneMKL-dependent parts of the code are enable in next build."
|
|
|
|
export MKL="-DMKL"
|
|
|
|
if [[ $2 == mkl ]]
|
|
|
|
then
|
|
|
|
echo "* Threshold of '$3' will be used in next build."
|
|
|
|
export THRESHOLD="-DTHRESHOLD=$3"
|
|
|
|
else
|
|
|
|
echo "* Threshold of '$2' will be used in next build."
|
|
|
|
export THRESHOLD="-DTHRESHOLD=$2"
|
|
|
|
fi
|
2021-05-21 16:19:08 +02:00
|
|
|
fi
|