forked from TREX-CoE/Sherman-Morrison
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smvars.sh
104 lines (99 loc) · 2.36 KB
/
smvars.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
unset THRESHOLD
unset MKL
ENV=$1
echo
echo "Sherman-Morrison-Woodbury parameters"
echo "------------------------------------"
## 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)
echo "* SM build environment set to 'intel'"
export HDF5_CXX=icpc
export HDF5_CXXLINKER=icpc
export HDF5_CLINKER=icpc
export ENV=INTEL
;;
llvm)
echo "* SM build environment set to 'llvm'"
export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++
export HDF5_CLINKER=clang++
export ENV=LLVM
;;
vfc)
echo "* SM build environment set to 'vfc'"
export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++
export HDF5_CLINKER=clang++
export ENV=LLVM
export VFC_BACKENDS="libinterflop_ieee.so --count-op"
;;
gnu)
echo "* SM build environment set to 'gnu'"
export HDF5_CXX=g++
export HDF5_CXXLINKER=g++
export HDF5_CLINKER=g++
export ENV=GNU
;;
*)
echo "Unknown environment descriptor given."
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu}"
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [mkl]"
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [threshold]"
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [mkl] [threshold]"
echo "Usage: source smvars.sh {intel | llvm | vfc | gnu} [threshold] [mkl]"
return 1
;;
esac
## Export path, but only once
if [[ -z $SMVARS ]]
then
export PATH=$SMROOT/bin:$PATH
export SMVARS=true
fi
## Argument parsing
if [[ $# -eq 1 ]]
then
echo "* Default threshold of '1e-3' will be used in next build."
fi
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
fi