SCM Repository
Annotation of /sml/branches/SMLNJ/benchmarks/runit
Parent Directory
|
Revision Log
Revision 194 - (view) (download)
1 : | monnier | 193 | #!/bin/ksh |
2 : | # | ||
3 : | # Usage: speed [options] [benchmarks] | ||
4 : | # | ||
5 : | #set -x | ||
6 : | |||
7 : | CMD=$0 | ||
8 : | |||
9 : | SML=${SML:=/usr/local/bin/sml} | ||
10 : | SRC=`pwd` | ||
11 : | NRUNS=6 | ||
12 : | OUT_FILE=LOG | ||
13 : | ALLOC=512k | ||
14 : | |||
15 : | |||
16 : | FP_TESTS="simple mandelbrot ray barnes-hut" | ||
17 : | ALL_TESTS="boyer life knuth-bendix lexgen mlyacc vliw $FP_TESTS" | ||
18 : | NEW_TESTS="fft logic tsp" | ||
19 : | ALL_TESTS="$ALL_TESTS $NEW_TESTS" | ||
20 : | |||
21 : | |||
22 : | # | ||
23 : | # process arguments | ||
24 : | # | ||
25 : | while [ "$#" != "0" ] | ||
26 : | do | ||
27 : | arg=$1; shift | ||
28 : | case $arg in | ||
29 : | -sml) | ||
30 : | if [ "$#" = "0" ]; then | ||
31 : | echo "$CMD must supply argument for -sml option" | ||
32 : | exit 1 | ||
33 : | fi | ||
34 : | SML=$1; shift | ||
35 : | ;; | ||
36 : | -out) | ||
37 : | if [ "$#" = "0" ]; then | ||
38 : | echo "$CMD must supply file name with -out option" | ||
39 : | exit 1 | ||
40 : | fi | ||
41 : | OUT_FILE=$1; shift | ||
42 : | ;; | ||
43 : | -alloc) | ||
44 : | if [ "$#" = "0" ]; then | ||
45 : | echo "$CMD must supply allocation size with -alloc option" | ||
46 : | exit 1 | ||
47 : | fi | ||
48 : | ALLOC=$1; shift | ||
49 : | ;; | ||
50 : | *) | ||
51 : | echo "$CMD Usage: runit [-sml <sml-path>] [-out <file>] [-alloc <size>]" | ||
52 : | exit 1 | ||
53 : | ;; | ||
54 : | esac | ||
55 : | done | ||
56 : | |||
57 : | SML="$SML @SMLalloc=$ALLOC" | ||
58 : | echo Using $SML ... | ||
59 : | # | ||
60 : | # run the tests | ||
61 : | # | ||
62 : | |||
63 : | /bin/rm -rf programs/CM | ||
64 : | echo "[" >> $OUT_FILE | ||
65 : | for prog in $ALL_TESTS; do | ||
66 : | if [[ $prog = "knuth-bendix" ]] | ||
67 : | then | ||
68 : | name=knuthBendix | ||
69 : | elif [[ $prog = "barnes-hut" ]] | ||
70 : | then | ||
71 : | name=barnesHut | ||
72 : | else | ||
73 : | name=$prog | ||
74 : | fi | ||
75 : | |||
76 : | echo $name | ||
77 : | # | ||
78 : | # measure interactive compile time | ||
79 : | # | ||
80 : | echo " compiling ..." | ||
81 : | echo "{Bmark=\"$name\"," >> $OUT_FILE | ||
82 : | $SML <<EOF 1>/dev/null 2>&1 | ||
83 : | use "programs/timeit.sml"; | ||
84 : | val outstrm = TextIO.openAppend("$OUT_FILE"); | ||
85 : | fun compileIt (n, outstrm, fname) = let | ||
86 : | |||
87 : | fun loop 0 = () | ||
88 : | | loop i = let | ||
89 : | val t0 = Timing.start() | ||
90 : | in | ||
91 : | use fname; | ||
92 : | Timing.output(outstrm, Timing.stop t0); | ||
93 : | TextIO.output(outstrm, if i>1 then ",\n" else "\n"); | ||
94 : | TextIO.flushOut outstrm; | ||
95 : | loop (i-1) | ||
96 : | end | ||
97 : | in | ||
98 : | TextIO.output(outstrm, " Compiles=[\n"); | ||
99 : | TextIO.output(TextIO.stdOut, "in compileIt\n"); | ||
100 : | loop n; | ||
101 : | TextIO.output(outstrm, "\t],\n") | ||
102 : | end; | ||
103 : | |||
104 : | Compiler.Control.MC.matchRedundantError := false; | ||
105 : | OS.FileSys.chDir "programs/$prog"; | ||
106 : | compileIt(1, outstrm, "load"); | ||
107 : | TextIO.flushOut outstrm; | ||
108 : | TextIO.closeOut outstrm; | ||
109 : | EOF | ||
110 : | |||
111 : | # | ||
112 : | # measure execution time | ||
113 : | # | ||
114 : | echo " running ..." | ||
115 : | /bin/rm -rf programs/$prog/CM | ||
116 : | $SML <<EOF 1>/dev/null 2>&1 | ||
117 : | Compiler.Control.MC.matchRedundantError := false; | ||
118 : | OS.FileSys.chDir "programs/$prog"; | ||
119 : | CM.make(); | ||
120 : | EOF | ||
121 : | |||
122 : | # | ||
123 : | # run it. | ||
124 : | # | ||
125 : | $SML <<EOF 1>/dev/null 2>&1 | ||
126 : | val outstrm = TextIO.openAppend("$OUT_FILE"); | ||
127 : | OS.FileSys.chDir "programs/$prog"; | ||
128 : | CM.make(); | ||
129 : | Timing.time($NRUNS, outstrm, Main.doit); | ||
130 : | TextIO.output(outstrm, "};\n"); | ||
131 : | TextIO.output(outstrm, "\n"); TextIO.flushOut outstrm; | ||
132 : | TextIO.closeOut outstrm; | ||
133 : | EOF | ||
134 : | /bin/rm -rf programs/$prog/CM | ||
135 : | done | ||
136 : | echo "{Bmark=\"$OUT_FILE\", Compiles=[], Runs=[]}]" >> $OUT_FILE | ||
137 : | /bin/rm -rf programs/CM |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |