Sherman-Morrison/smvars.sh
Francois Coppens b863d40c05 - Setting break-down threshold trough smvars.sh
- Fixed SM3 to escape infinite update-loop
2021-04-15 18:13:26 +02:00

64 lines
1.1 KiB
Bash

#!/usr/bin/env bash
unset THRESHOLD
ENV=$1
THRESHOLD=$2
## Set Sherman-Morrison root dir
PWD=$(pwd)
SRCDIR=$(dirname $BASH_SOURCE)
case $SRCDIR in
/*) SMROOT=$SRCDIR ;;
*)
if [[ $SRCDIR = . ]]
then
SMROOT=$PWD
else
SMROOT=$PWD/$SRCDIR
fi
;;
esac
export SMROOT
## Set environment for hdf5-tools and Makefile
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
;;
vfc)
export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++
export ENV=LLVM
export VFC_BACKENDS="libinterflop_ieee.so --count-op"
;;
gnu)
export HDF5_CXX=g++
export HDF5_CXXLINKER=g++
export ENV=GNU
;;
*)
echo "Unknown environment descriptor given."
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu}"
return 1
;;
esac
## Export path, but only once
if [[ -z $SMVARS ]]
then
export PATH=$SMROOT/bin:$PATH
export SMVARS=true
fi
## If a threshold is provided, export compiler flag
if [[ $# -gt 1 ]]
then
export THRESHOLD="-DTHRESHOLD=$THRESHOLD"
fi