forked from eldesh/aobench_sml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta-aobench.sh
executable file
·61 lines (56 loc) · 1.08 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
#!/bin/bash
function bench () {
case "$1" in
sml)
sml @SMLload=aobench-image aobench-sml.ppm
;;
gcc | mlton | smlsharp-1.2.0 | smlsharp-2.0.0)
./aobench-${1} aobench-${1}.ppm
;;
*)
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
;;
smlsharp-1.2.0)
make -f makefile-smlsharp-1.2.0 clean
make -f makefile-smlsharp-1.2.0
;;
smlsharp-2.0.0)
make -f makefile-smlsharp-2.0.0 clean
make -f makefile-smlsharp-2.0.0
;;
*)
echo "unkown compiler [$1]"
;;
esac
}
# number of iteration
N=1
compiler=(gcc sml mlton smlsharp-1.2.0 smlsharp-2.0.0)
for (( i=0; i<${#compiler[@]}; i++ ))
do
# check existence
which ${compiler[$i]} >/dev/null 2>&1
if [ $? -eq 0 ]; then
build ${compiler[$i]}
echo "${compiler[$i]} is running"
time for (( j=0; j<$N; j++ ))
do
bench ${compiler[$i]}
done
else
echo "${compiler[$i]} is not found :("
fi
done