-
Notifications
You must be signed in to change notification settings - Fork 2
/
meta-aobench.sh
executable file
·88 lines (80 loc) · 1.48 KB
/
meta-aobench.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
#!/bin/bash
function bench () {
case "$1" in
sml)
sml @SMLload=aobench-image aobench-sml.ppm
;;
gcc | mlton | mlkit | poly)
./aobench-${1} aobench-${1}.ppm
;;
smlsharp)
if [ -n "$2" ]; then
MYTH_NUM_WORKERS=$2 ./aobench-${1}-par aobench-${1}-par.ppm 4
else
./aobench-${1} aobench-${1}.ppm
fi
;;
mpl)
./aobench-${1} @mpl procs 4 set-affinity -- aobench-${1}.ppm 4
;;
*)
echo "unkown compiler [$1]"
;;
esac
}
function build () {
case "$1" in
sml)
ml-build aobench.cm AObench.main aobench-image
;;
gcc)
gcc -std=gnu99 -O2 -Wall --pedantic-errors -o aobench-gcc aobench.c -lm
;;
mlton)
mlton -output aobench-mlton aobench.mlb
;;
mlkit)
mlkit -output aobench-mlkit aobench-mlkit.mlb
;;
smlsharp)
make -f makefile-smlsharp
;;
poly)
make -f makefile-poly
;;
mpl)
mpl -output aobench-mpl aobench-mpl.mlb
;;
*)
echo "unkown compiler [$1]"
;;
esac
}
# number of iteration
N=1
compiler=(gcc sml mlton mlkit smlsharp poly mpl)
for (( i=0; i<${#compiler[@]}; i++ ))
do
# check existence
which ${compiler[$i]} >/dev/null 2>&1
if [ $? -eq 0 ]; then
build ${compiler[$i]}
if [ $? -ne 0 ]; then
echo "building with ${compiler[$i]} failed" >&2
continue
fi
echo "${compiler[$i]} is running"
time for (( j=0; j<$N; j++ ))
do
bench ${compiler[$i]}
done
if [ ${compiler[$i]} = smlsharp ]; then
time for (( j=0; j<$N; j++ ))
do
bench smlsharp 4
done
fi
else
echo "${compiler[$i]} is not found :(" >&2
fi
done