-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathci-sc-dlr.sh
More file actions
executable file
·109 lines (86 loc) · 2.66 KB
/
ci-sc-dlr.sh
File metadata and controls
executable file
·109 lines (86 loc) · 2.66 KB
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
105
106
107
108
109
#!/usr/bin/env bash
set -e
## default options and declarations
# kernel lib
PRGENV="gcc-4.9.2-openmpi-1.10.1" # intel-13.0.1-mpich gcc-4.8.2-openmpi
BUILD_TYPE=Release
INSTALL_PREFIX=../../
# list of modules to load
MODULES_BASIC="cmake ccache"
## parse command line arguments
usage() { echo "Usage: $0 [-e <PrgEnv/module-string>] [-b <Release|Debug|...>]" 1>&2;
exit 1; }
while getopts "e:b:p:h" o; do
case "${o}" in
e)
PRGENV=${OPTARG}
;;
b)
BUILD_TYPE=${OPTARG}
;;
p)
INSTALL_PREFIX=${OPTARG}
;;
h)
usage
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
echo "Options: PRGENV=${PRGENV}, BUILD_TYPE=${BUILD_TYPE}"
## prepare system for compilation
# configure modulesystem
export MODULEPATH=/tools/modulesystem/modulefiles
module() { eval `/usr/bin/modulecmd bash $*`; }
# load modules
module load "PrgEnv/$PRGENV"
# set compiler names
if [[ "$PRGENV" =~ gcc* ]]; then
export FC="gfortran" CC="gcc" CXX="g++"
elif [[ "$PRGENV" =~ intel* ]]; then
export FC=ifort CC=icc CXX=icpc
else
set -- $(mpicc -show)
export CC=$1
set -- $(mpicxx -show)
export CXX=$1
set -- $(mpif90 -show)
export FC=$1
fi
echo "compilers: CC=$CC, CXX=$CXX, FC=$FC"
for m in $MODULES_BASIC; do module load $m; done
module list
# "gcc -fsanitize=address" requires this
ulimit -v unlimited
build_dir=build_${PRGENV}_${BUILD_TYPE}
build_examples_dir=build_examples_${PRGENV}_${BUILD_TYPE}
install_dir=$INSTALL_PREFIX/install-${PRGENV}-${BUILD_TYPE}
error=0
function update_error {
if [[ "${error}" = "0" ]]; then
error=$1
fi
}
# build and install
mkdir $build_dir || update_error ${LINENO}
cd $build_dir || update_error ${LINENO}
cmake -DCMAKE_INSTALL_PREFIX=$install_dir \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=ON .. || update_error ${LINENO}
make -j 24 || make || update_error ${LINENO}
make install || update_error ${LINENO}
cd .. || update_error ${LINENO}
# build examples
mkdir ${build_examples_dir} || update_error ${LINENO}
cd ${build_examples_dir} || update_error ${LINENO}
export CMAKE_PREFIX_PATH=$install_dir:${CMAKE_PREFIX_PATH}
cmake ../examples || update_error ${LINENO}
make -j || make || update_error ${LINENO}
gunzip -k -c ../examples/matrices/spinSZ12.mm.gz > spinSZ12.mm || update_error ${LINENO}
# a simple test, just run with some example matrix
./race -v -m spinSZ12.mm -c 12 -i 25 &> test.log || update_error ${LINENO}
grep -i "validated coloring" test.log || update_error ${LINENO}
#return error code
exit $error