2021-04-01 13:49:53 +02:00
|
|
|
#!/usr/bin/env bash
|
2021-04-15 18:13:26 +02:00
|
|
|
unset THRESHOLD
|
2021-04-01 13:49:53 +02:00
|
|
|
ENV=$1
|
2021-04-15 18:13:26 +02:00
|
|
|
THRESHOLD=$2
|
2021-04-01 13:49:53 +02:00
|
|
|
|
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)
|
|
|
|
export HDF5_CXX=icpc
|
|
|
|
export HDF5_CXXLINKER=icpc
|
|
|
|
export ENV=INTEL
|
|
|
|
;;
|
|
|
|
llvm)
|
|
|
|
export HDF5_CXX=clang++
|
|
|
|
export HDF5_CXXLINKER=clang++
|
|
|
|
export ENV=LLVM
|
|
|
|
;;
|
2021-04-14 11:42:45 +02:00
|
|
|
vfc)
|
|
|
|
export HDF5_CXX=clang++
|
|
|
|
export HDF5_CXXLINKER=clang++
|
|
|
|
export ENV=LLVM
|
|
|
|
export VFC_BACKENDS="libinterflop_ieee.so --count-op"
|
|
|
|
;;
|
2021-04-01 13:49:53 +02:00
|
|
|
gnu)
|
|
|
|
export HDF5_CXX=g++
|
|
|
|
export HDF5_CXXLINKER=g++
|
|
|
|
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-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
|
|
|
|
|
|
|
## If a threshold is provided, export compiler flag
|
|
|
|
if [[ $# -gt 1 ]]
|
|
|
|
then
|
|
|
|
export THRESHOLD="-DTHRESHOLD=$THRESHOLD"
|
|
|
|
fi
|