This repository has been archived by the owner on Aug 9, 2019. It is now read-only.
forked from naoyam/tapas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·175 lines (138 loc) · 3.79 KB
/
test.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash
#
#-------------------------------------------------------------------------------
# setup.sh
#
# Usage:
# $ sh test.sh
#
#
#-------------------------------------------------------------------------------
set -u
set -e
unset TMPFILE
atexit() {
[[ -n "${TMPFILE-}" ]] && rm -f "$TMPFILE"
}
# To trap an error caused by "set -e"
onerror()
{
status=$?
script=$0
line=$1
shift
args=
for i in "$@"; do
args+="\"$i\" "
done
echo ""
echo "------------------------------------------------------------"
echo "Error occured on $script [Line $line]: Status $status"
echo ""
echo "PID: $$"
echo "User: $USER"
echo "Current directory: $PWD"
echo "Command line: $script $args"
echo "------------------------------------------------------------"
echo ""
}
trap atexit EXIT
trap 'trap - EXIT; atexit; exit -1' INT PIPE TERM
trap 'onerror $LINENO "$@"' ERR
TMPFILE=$(mktemp "/tmp/${0##*/}.tmp.XXXXXXX")
echo TMPFILE=${TMPFILE}
function echoRed() {
printf "\033[0;31m"
echo "$*"
printf "\033[0;39m"
}
function echoGreen() {
printf "\033[0;32m"
echo "$*"
printf "\033[0;39m"
}
function echoCyan() {
printf "\033[0;36m"
echo "$*"
printf "\033[0;39m"
}
function get_script_dir() {
pushd `dirname $0` >/dev/null
DIR=`pwd`
popd >/dev/null
echo $DIR
}
echo --------------------------------------------------------------------
#------------------------------------------------------------------------
# setup
#------------------------------------------------------------------------
TMP_DIR=/tmp/tapas-build
SRC_ROOT=`get_script_dir`
if [[ -z "${SCALE-}" ]]; then
SCALE=s
fi
STATUS=0
MAX_ERR="5e-2"
mkdir -p $TMP_DIR
cd $TMP_DIR
echo test.sh
echo Started at $(date)
echo "hostname=" $(hostname)
echo "compiler=" ${CXX}
echo "scale = ${SCALE}"
echo date
date
echo pwd
pwd
echo "SRC_ROOT=$SRC_ROOT"
echo "TMP_DIR=$TMP_DIR"
echo "ls /usr/bin/gcc*"
ls /usr/bin/gcc*
echo "ls /usr/bin/g++*"
ls /usr/bin/g++*
echo PATH=$PATH
if [[ -z "${CXX:-}" ]]; then
CXX=g++
fi
echo CXX=$(which ${CXX})
if [[ -d "${MYTH_DIR:-}" ]]; then
echo MassiveThreads is activated. MYTH_DIR=${MYTH_DIR}
else
echo MassiveThreads is NOT activated.
fi
# Call unit test
/bin/bash $SRC_ROOT/tests/test.sh
# Call BH test
/bin/bash $SRC_ROOT/samples/barnes-hut/test.sh
# Call FMM test
/bin/bash $SRC_ROOT/samples/fmm/test.sh
exit $STATUS
# Check the GPU version if nvcc is available
if which nvcc >/dev/null 2>&1; then
NVCC_OPT="-O3 -Xcicc -Xptas --compiler-options -Wall --compiler-options -Wextra --compiler-options -Wno-unused-parameter \
-Xcompiler -rdynamic -lineinfo --device-debug -x cu -arch sm_35 -ccbin=g++"
which g++
BIN=parallel_tapas_cuda
SRC_DIR=$SRC_ROOT/samples/exafmm-dev-13274dd4ac68/examples
compile=$($MPICXX -show -cxx=nvcc -DTAPAS_DEBUG=0 -DUSE_MPI -g $NVCC_OPT \
-DASSERT -DTAPAS_USE_VECTORMAP -DFP64 -DSpherical -DEXPANSION=6 -DTAPAS_LOG_LEVEL=0 \
-I$SRC_DIR/../include -I$SRC_DIR -I$SRC_DIR/../../../cpp/include \
-std=c++11 $SRC_DIR/../kernels/LaplaceP2PCPU.cxx $SRC_DIR/../kernels/LaplaceSphericalCPU.cxx \
$SRC_DIR/tapas_exafmm.cxx -o $BIN)
# nvcc doesn't spport -Wl,... options
compile=$(echo $compile | sed -e 's/-Wl,[^ ]*//g')
echo $compile
$compile
for dist in ${DIST[@]}; do
for nb in ${NB_FMM[@]}; do
for ncrit in ${NCRIT[@]}; do
echoCyan ${MPIEXEC} -n 1 ./$BIN --numBodies 1000
${MPIEXEC} -n 1 ./$BIN --numBodies 10000 > $TMPFILE
if [[ ! "${QUIET:-}" == "1" ]]; then
cat $TMPFILE
fi
accuracyCheck $TMPFILE
done
done
done
fi