-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_all_FROMPACKED.sh
executable file
·283 lines (213 loc) · 8.47 KB
/
run_all_FROMPACKED.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/bin/bash
cd `dirname $0`
## DUPLICATED CODE:
## THIS IS A HACK ON TOP OF THE run_all_examples.sh SCRIPT
## THIS ONE RUNS THE PRECOMPILED EXECUTABLES THAT HAVE BEEN PACKED UP.
FORLATER=.
# Settings:
# ----------------------------------------
#export GHC=ghc-6.13.20100511
#export GHC=~/bin/Linux-i686/bin/ghc-6.13.20100511
unset HASKELLCNC
# Which subset of schedures should we test:
#PURESCHEDS=""
PURESCHEDS="2 3"
#IOSCHEDS="3 4 5 6 7 8"
IOSCHEDS="4 7 8 3 10 11"
#IOSCHEDS="10 100"
SEPARATESCHEDS=""
if [ "$THREADSETTINGS" == "" ]
then THREADSETTINGS="4"
fi
source default_opt_settings.sh
# Where to put the timing results:
RESULTS=results.dat
if [ -e $RESULTS ];
then BAK="$RESULTS".bak.`date +%s`
echo "Backing up old results to $BAK"
mv $RESULTS $BAK
fi
# How many times to run a process before taking the best time:
if [ "$TRIALS" == "" ]; then
TRIALS=1
fi
# Determine number of hardware threads on the machine:
# if [ -f /proc/cpuinfo ];
if [ -d /sys/devices/system/cpu/ ];
then
MAXTHREADS=`ls /sys/devices/system/cpu/ | grep "cpu[0123456789]*$" | wc -l`
echo "Detected the number of CPUs on the machine to be $MAXTHREADS"
elif [ `uname` == "Darwin" ];
then MAXTHREADS=`sysctl -n hw.ncpu`
else MAXTHREADS=2
fi
if [ "$THREADSETTINGS" == "" ]; then
THREADSETTINGS=$MAXTHREADS
#for ((i=1; i <= $MAX; i++)); do THREADSETTINGS="$THREADSETTINGS $i"; done
fi
# ================================================================================
echo "# TestName Variant Scheduler NumThreads HashHackEnabled MinTime MedianTime MaxTime" > $RESULTS
echo "# "`date` >> $RESULTS
#echo "# "`uname -a` >> $RESULTS
#echo "# REMOTE EXECUTION FROM "`uname -a`" TO $REMOTE " >> $RESULTS
echo "# EXECUTION FROM PACKED BENCHMARKS ON "`uname -a`" " >> $RESULTS
# echo "# "`ghc -V` >> $RESULTS
echo "# "
echo "# Running each test for $TRIALS trials." >> $RESULTS
echo "# ... with default compiler options: $GHC_DEFAULT_FLAGS" >> $RESULTS
echo "# ... with default runtime options: $GHC_DEFAULT_RTS" >> $RESULTS
cnt=0
source run_all_shared.sh
# Dynamic scoping. Lame. This uses $test.
function runit()
{
cnt=$((cnt+1))
echo
echo "--------------------------------------------------------------------------------"
echo " Running Config $cnt: $test variant $CNC_VARIANT sched $CNC_SCHEDULER threads $NUMTHREADS $hashtab"
echo "--------------------------------------------------------------------------------"
echo
echo "(In directory `pwd`)"
if [ "$NUMTHREADS" != "0" ] && [ "$NUMTHREADS" != "" ]
then export RTS=" $GHC_DEFAULT_RTS -s -N$NUMTHREADS "
else export RTS=""
fi
if [ "$hashtab" == "" ];
then HASH="0"
else HASH="1"
fi
# We compile the test case using runcnc:
# NORUN=1 ./runcnc $hashtab examples/"$test".hs
# CODE=$?
# check_error $CODE "ERROR: compilation failed."
#====================================================================================================
TARGETDIR="$FORLATER/$CNC_VARIANT/$sched"
# mkdir -p "$TARGETDIR"
EXENAME="$TARGETDIR/$test".exe
echo
echo "RUNNING PRE-PACKED EXECUTABLE: $EXENAME "
if ! [ -e "$EXENAME" ]; then
echo "# ERROR FILE DOES NOT EXIST: $EXENAME"
echo "# ERROR FILE DOES NOT EXIST: $EXENAME" >> $RESULTS
# exit 1
fi
#====================================================================================================
echo "Executing $NTIMES $TRIALS $EXENAME $ARGS +RTS $RTS -RTS "
if [ "$LONGRUN" == "" ]; then export HIDEOUTPUT=1; fi
if [ -e "$EXENAME" ]; then
times=`$NTIMES "$TRIALS" $EXENAME $ARGS +RTS $RTS -RTS`
else
times="ERR ERR ERR"
fi
CODE=$?
#====================================================================================================
echo " >>> MIN/MEDIAN/MAX TIMES $times"
check_error $CODE "ERROR: run_all_tests this test failed completely: $test.exe"
if [ "$CODE" == "143" ];
then echo "$test.exe" "$CNC_VARIANT" "$CNC_SCHEDULER" "$NUMTHREADS" "$HASH" "TIMEOUT TIMEOUT TIMEOUT" >> $RESULTS
elif [ "$CODE" != "0" ] ;
then echo "$test.exe" "$CNC_VARIANT" "$CNC_SCHEDULER" "$NUMTHREADS" "$HASH" "ERR ERR ERR" >> $RESULTS
else
echo "$test.exe" "$CNC_VARIANT" "$CNC_SCHEDULER" "$NUMTHREADS" "$HASH" "$times" >> $RESULTS
fi
}
echo "Running all tests, for THREADSETTINGS in {$THREADSETTINGS}"
echo
# Hygiene:
rm -f examples/*.exe
#====================================================================================================
function run_benchmark() {
set -- $line
test=$1; shift
if [ "$LONGRUN" == "" ];
# If we're not in LONGRUN mode we run each executable with no
# arguments causing it to go to its default problem size.
then ARGS=
else ARGS=$*
fi
echo "================================================================================"
echo " Running Test: $test.exe $ARGS "
echo "================================================================================"
echo "# *** Config [$cnt ..], testing with command/args: $test.exe $ARGS " >> $RESULTS
export CNC_VARIANT=io
for sched in $IOSCHEDS; do
export CNC_SCHEDULER=$sched
#for NUMTHREADS in 4; do
for NUMTHREADS in $THREADSETTINGS; do
# Running with the hashtable hack off:
export hashtab=""
runit
# This one is incorrect and nondeterministic:
# export hashtab="-DHASHTABLE_TEST"; runit
done # threads
echo >> $RESULTS;
done # schedulers
export CNC_VARIANT=pure
# Currently running the pure scheduler only in single threaded mode:
for sched in $PURESCHEDS; do
if [ "$sched" == "3" ]; then
for NUMTHREADS in $THREADSETTINGS; do
export hashtab=""
runit
done # threads
elif [ "$sched" == "2" ]; then
# Pure 2:
export NUMTHREADS=0
unset hashtab
export CNC_SCHEDULER=$sched
runit
else
echo "# ERROR Problem in script in handling pure Sched $sched " >> $RESULTS;
fi
echo >> $RESULTS;
done
# Finally, run once through separately compiled modules to compare performance (and make sure they build).
# This will basically use the IO based implementation with the default scheduler.
# for sched in $SEPARATESCHEDS; do
# export CNC_SCHEDULER=$sched
# export NUMTHREADS=4
# runit
# done
echo >> $RESULTS;
echo >> $RESULTS;
}
# Read $line and do the benchmark with ntimes_binsearch.sh
function run_binsearch_benchmark() {
NTIMES=./ntimes_binsearch.sh
run_benchmark
NTIMES=UNSET
}
# Read $line and do the benchmark with ntimes_minmedmax
function run_normal_benchmark() {
NTIMES=./ntimes_minmedmax
run_benchmark
NTIMES=UNSET
}
#====================================================================================================
# This specifies the list of tests and their arguments for a "long" run:
#for line in "mandel_opt 1 300 300 4000" "mandel_opt 2 300 300 4000" "mandel_opt 3 300 300 4000" "mandel 300 300 4000"; do
#
#for line in "par_seq_par_seq 8.5" "embarrassingly_par 9.2" "primes2 200000" "mandel 300 300 4000" "mandel_opt 1 300 300 4000" "sched_tree 18" "fib 20000" "threadring 50000000 503" "nbody 1200" "primes 200000"; do
# Parallel benchmarks only:
#for line in "par_seq_par_seq 8.5" "embarrassingly_par 9.2" "primes2 200000" "mandel 300 300 4000" "mandel_opt 1 300 300 4000" "sched_tree 18" "nbody 1200" "primes 200000"; do
# Finish up...
#for line in "mandel 300 300 4000" "mandel_opt 1 300 300 4000" "sched_tree 18" "nbody 1200" "primes 200000"; do
#------------------------------------------------------------
# BIG RUNS FOR HEFTY MACHINES
#------------------------------------------------------------
# for line in ; do
# for line in "sched_tree 20" "nbody 2400" "primes 1000000" "mandel_opt 300 300 20000"; do
# Run benchmarks of linear complexity
# for line in "blackscholes 10000" "embarrassingly_par " "par_seq_par_seq " "mandel_opt 2 300 300" "mandel 300 300 " ; do
# #for line in "mandel_opt 2 300 300" "mandel 300 300 " ; do
# run_binsearch_benchmark
# done
# These are of non-linear complexity or I just want to put hem last:
#for line in "primes2 1000000" "primes 1000000" "nbody 2400" "sched_tree 19"; do
# Ok, giving up and going back to normal mode:
for line in "nbody 10000" "blackscholes 10000 50000000" "mandel_opt2 2 300 300 20000" "cholesky 1000 50 m1000.in" "embarrassingly_par 9.8" "par_seq_par_seq 9.2" "primes2 1000000" "sched_tree 19" "mandel 300 300 20000" "mandel_opt 1 300 300 20000" "primes 1000000";
#for line in "cholesky 2000 100 m1000.in";
do
run_normal_benchmark
done
echo "Finished with all test configurations."