Debian Codegraph @

misc/bench-gccs

raw symbols SCIP
1 #!/bin/sh
2
3 ### File: "bench-gccs"
4
5 ### Copyright (c) 2012 by Marc Feeley, All Rights Reserved.
6
7 # The following definitions should be adjusted to your context.
8
9 # The set of gcc versions to install
10 gcc_versions="\
11 2.95 \
12 2.95.1 \
13 2.95.2 \
14 2.95.3 \
15 3.0 \
16 3.0.1 \
17 3.0.2 \
18 3.0.3 \
19 3.0.4 \
20 3.1 \
21 3.1.1 \
22 3.2 \
23 3.2.1 \
24 3.2.2 \
25 3.2.3 \
26 3.3 \
27 3.3.1 \
28 3.3.2 \
29 3.3.3 \
30 3.3.4 \
31 3.3.5 \
32 3.3.6 \
33 3.4.0 \
34 3.4.1 \
35 3.4.2 \
36 3.4.3 \
37 3.4.4 \
38 3.4.5 \
39 3.4.6 \
40 4.0.0 \
41 4.0.1 \
42 4.0.2 \
43 4.0.3 \
44 4.0.4 \
45 4.1.0 \
46 4.1.1 \
47 4.1.2 \
48 4.2.0 \
49 4.2.1 \
50 4.2.2 \
51 4.2.3 \
52 4.2.4 \
53 4.3.0 \
54 4.3.1 \
55 4.3.2 \
56 4.3.3 \
57 4.3.4 \
58 4.3.5 \
59 4.3.6 \
60 4.4.0 \
61 4.4.1 \
62 4.4.2 \
63 4.4.3 \
64 4.4.4 \
65 4.4.5 \
66 4.4.6 \
67 4.4.7 \
68 4.5.0 \
69 4.5.1 \
70 4.5.2 \
71 4.5.3 \
72 4.6.0 \
73 4.6.1 \
74 4.6.2 \
75 4.6.3 \
76 4.7.0 \
77 "
78
79 # The URL where the gcc sources are downloaded from
80 gcc_url="http://mirror.csclub.uwaterloo.ca/gnu/gcc"
81
82 # The directory where the gcc versions are installed
83 gcc_install_dir="$HOME/gcc-install"
84
85 # The directory where Gambit compiled by the various gcc versions are installed
86 install_dir="$HOME/gambit-install"
87
88 get_gcc_filename()
89 {
90 gcc_version="$1"
91
92 if [[ "$gcc_version" < "3.4" ]]; then
93 gcc_extension=".tar.gz"
94 else
95 gcc_extension=".tar.bz2"
96 fi
97
98 gcc_dir="gcc-$gcc_version"
99 gcc_filename="gcc-$gcc_version$gcc_extension"
100 gcc_key="`echo \"$gcc_version\" | sed -e 's/\./_/g'`"
101 }
102
103 download_gcc()
104 {
105 gcc_version="$1"
106
107 get_gcc_filename "$gcc_version"
108
109 if [[ "$gcc_version" < "3" ]]; then
110 directory=""
111 else
112 directory="gcc-$gcc_version/"
113 fi
114
115 if [ ! -e "$gcc_install_dir" ]; then
116 mkdir "$gcc_install_dir"
117 fi
118
119 if [ ! -e "$gcc_install_dir/$gcc_version" ]; then
120 mkdir "$gcc_install_dir/$gcc_version"
121 fi
122
123 if [ ! -e "$gcc_install_dir/$gcc_version/.download" ]; then
124 mkdir "$gcc_install_dir/$gcc_version/.download"
125 fi
126
127 if [ ! -e "$gcc_install_dir/$gcc_version/.download/$gcc_filename" ]; then
128 wget -O "$gcc_install_dir/$gcc_version/.download/$gcc_filename" "$gcc_url/$directory$gcc_filename"
129 #curl -o "$gcc_install_dir/$gcc_version/.download/$gcc_filename" "$gcc_url/$directory$gcc_filename"
130 fi
131 }
132
133 unpack_gcc()
134 {
135 gcc_version="$1"
136
137 get_gcc_filename "$gcc_version"
138
139 if [ ! -e "$gcc_install_dir/$gcc_version/.sources" ]; then
140 mkdir "$gcc_install_dir/$gcc_version/.sources"
141 fi
142
143 if [ ! -e "$gcc_install_dir/$gcc_version/.sources/$gcc_dir" ]; then
144
145 here="`pwd`"
146
147 cd "$gcc_install_dir/$gcc_version/.sources"
148
149 if [[ "$gcc_extension" == ".tar.bz2" ]]; then
150 bunzip2 -c "../.download/$gcc_filename" | tar xf -
151 else
152 gunzip -c "../.download/$gcc_filename" | tar xf -
153 fi
154
155 cd "$gcc_dir"
156
157 if [[ "$gcc_version" < "3.3.4" ]]; then
158 if [ -e "include/obstack.h" ]; then
159 sed -e "s/if defined __GNUC__ && defined __STDC__ && __STDC__/if 0/" "include/obstack.h" > "include/obstack.h-new"
160 mv "include/obstack.h-new" "include/obstack.h"
161 fi
162 fi
163
164 cd "$here"
165
166 fi
167 }
168
169 compile_gcc()
170 {
171 gcc_version="$1"
172
173 get_gcc_filename "$gcc_version"
174
175 rm -rf "$gcc_install_dir/$gcc_version/.build"
176
177 mkdir "$gcc_install_dir/$gcc_version/.build"
178 mkdir "$gcc_install_dir/$gcc_version/.build/$gcc_dir"
179
180 here="`pwd`"
181
182 cd "$gcc_install_dir/$gcc_version/.build/$gcc_dir"
183
184 echo "====================================================== $gcc_install_dir/$gcc_version/.build/$gcc_dir"
185
186 eval "config_opts=\$config_opts_$gcc_key"
187
188 if (CC="$c_compiler_for_bootstrap" AS="$gcc_install_dir/.bin/as" ../../.sources/$gcc_dir/configure --prefix="$gcc_install_dir/$gcc_version" $config_opts && make bootstrap && make install) ; then
189 c_compiler_for_bootstrap_not="$gcc_install_dir/$gcc_version/bin/gcc"
190 fi
191
192 cd "$here"
193 }
194
195 config_opts_2_95=" i686-pc-linux-gnu --enable-languages=c"
196 config_opts_2_95_1=" i686-pc-linux-gnu --enable-languages=c"
197 config_opts_2_95_2=" i686-pc-linux-gnu --enable-languages=c"
198 config_opts_2_95_3=" i686-pc-linux-gnu --enable-languages=c"
199 config_opts_3_0=" i686-pc-linux-gnu --enable-languages=c"
200 config_opts_3_0_1=" i686-pc-linux-gnu --enable-languages=c"
201 config_opts_3_0_2=" i686-pc-linux-gnu --enable-languages=c"
202 config_opts_3_0_3=" i686-pc-linux-gnu --enable-languages=c"
203 config_opts_3_0_4=" i686-pc-linux-gnu --enable-languages=c"
204 config_opts_3_1=" i686-pc-linux-gnu --enable-languages=c"
205 config_opts_3_1_1=" i686-pc-linux-gnu --enable-languages=c"
206 config_opts_3_2=" i686-pc-linux-gnu --enable-languages=c"
207 config_opts_3_2_1=" i686-pc-linux-gnu --enable-languages=c"
208 config_opts_3_2_2=" i686-pc-linux-gnu --enable-languages=c"
209 config_opts_3_2_3=" i686-pc-linux-gnu --enable-languages=c"
210 config_opts_3_3=" i686-pc-linux-gnu --enable-languages=c"
211 config_opts_3_3_1=" i686-pc-linux-gnu --enable-languages=c"
212 config_opts_3_3_2=" i686-pc-linux-gnu --enable-languages=c"
213 config_opts_3_3_3=" i686-pc-linux-gnu --enable-languages=c"
214 config_opts_3_3_4=" i686-pc-linux-gnu --enable-languages=c"
215 config_opts_3_3_5=" i686-pc-linux-gnu --enable-languages=c"
216 config_opts_3_3_6=" i686-pc-linux-gnu --enable-languages=c"
217 config_opts_3_4_0=" i686-pc-linux-gnu --enable-languages=c"
218 config_opts_3_4_1=" i686-pc-linux-gnu --enable-languages=c"
219 config_opts_3_4_2=" i686-pc-linux-gnu --enable-languages=c"
220 config_opts_3_4_3=" i686-pc-linux-gnu --enable-languages=c"
221 config_opts_3_4_4=" i686-pc-linux-gnu --enable-languages=c"
222 config_opts_3_4_5=" i686-pc-linux-gnu --enable-languages=c"
223 config_opts_3_4_6=" i686-pc-linux-gnu --enable-languages=c"
224 config_opts_4_0_0=" i686-pc-linux-gnu --enable-languages=c"
225 config_opts_4_0_1=" i686-pc-linux-gnu --enable-languages=c"
226 config_opts_4_0_2=" i686-pc-linux-gnu --enable-languages=c"
227 config_opts_4_0_3=" i686-pc-linux-gnu --enable-languages=c"
228 config_opts_4_0_4=" i686-pc-linux-gnu --enable-languages=c"
229 config_opts_4_1_0=" i686-pc-linux-gnu --enable-languages=c"
230 config_opts_4_1_1=" i686-pc-linux-gnu --enable-languages=c"
231 config_opts_4_1_2=" i686-pc-linux-gnu --enable-languages=c"
232 config_opts_4_2_0=" i686-pc-linux-gnu --enable-languages=c"
233 config_opts_4_2_1=" i686-pc-linux-gnu --enable-languages=c"
234 config_opts_4_2_2=" i686-pc-linux-gnu --enable-languages=c"
235 config_opts_4_2_3=" i686-pc-linux-gnu --enable-languages=c"
236 config_opts_4_2_4=" i686-pc-linux-gnu --enable-languages=c"
237 config_opts_4_3_0=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
238 config_opts_4_3_1=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
239 config_opts_4_3_2=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
240 config_opts_4_3_3=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
241 config_opts_4_3_4=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
242 config_opts_4_3_5=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
243 config_opts_4_3_6=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
244 config_opts_4_4_0=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
245 config_opts_4_4_1=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
246 config_opts_4_4_2=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
247 config_opts_4_4_3=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
248 config_opts_4_4_4=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
249 config_opts_4_4_5=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
250 config_opts_4_4_6=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
251 config_opts_4_4_7=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr"
252 config_opts_4_5_0=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
253 config_opts_4_5_1=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
254 config_opts_4_5_2=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
255 config_opts_4_5_3=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
256 config_opts_4_6_0=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
257 config_opts_4_6_1=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
258 config_opts_4_6_2=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
259 config_opts_4_6_3=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
260 config_opts_4_7_0=" i686-pc-linux-gnu --enable-languages=c --with-gmp=$gcc_install_dir/.gmp --with-mpfr=$gcc_install_dir/.mpfr --with-mpc=$gcc_install_dir/.mpc"
261
262 build_gcc()
263 {
264 gcc_version="$1"
265
266 if [ ! -e "$gcc_install_dir/$gcc_version" ]; then
267
268 download_gcc "$gcc_version"
269 unpack_gcc "$gcc_version"
270 compile_gcc "$gcc_version"
271
272 fi
273 }
274
275 build_gmp()
276 {
277 if [ ! -e "$gcc_install_dir" ]; then
278 mkdir "$gcc_install_dir"
279 fi
280
281 if [ ! -e "$gcc_install_dir/.gmp" ]; then
282
283 mkdir "$gcc_install_dir/.gmp"
284
285 if [ ! -e "$gcc_install_dir/.gmp/.sources" ]; then
286 mkdir "$gcc_install_dir/.gmp/.sources"
287 fi
288
289 here="`pwd`"
290
291 cd "$gcc_install_dir/.gmp/.sources"
292
293 wget "ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2"
294
295 cd ..
296
297 rm -rf ".build"
298
299 bunzip2 -c ".sources/gmp-4.3.2.tar.bz2" | tar xf -
300 mv "gmp-4.3.2" ".build"
301
302 cd ".build"
303
304 ./configure --prefix="$gcc_install_dir/.gmp" i686-pc-linux-gnu CC='gcc -m32'
305
306 make
307
308 make check
309
310 make install
311
312 fi
313
314 cd "$here"
315 }
316
317 build_mpfr()
318 {
319 if [ ! -e "$gcc_install_dir" ]; then
320 mkdir "$gcc_install_dir"
321 fi
322
323 if [ ! -e "$gcc_install_dir/.mpfr" ]; then
324
325 mkdir "$gcc_install_dir/.mpfr"
326
327 if [ ! -e "$gcc_install_dir/.mpfr/.sources" ]; then
328 mkdir "$gcc_install_dir/.mpfr/.sources"
329 fi
330
331 here="`pwd`"
332
333 cd "$gcc_install_dir/.mpfr/.sources"
334
335 wget "ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2"
336
337 cd ..
338
339 rm -rf ".build"
340
341 bunzip2 -c ".sources/mpfr-2.4.2.tar.bz2" | tar xf -
342 mv "mpfr-2.4.2" ".build"
343
344 cd ".build"
345
346 ./configure --prefix="$gcc_install_dir/.mpfr" --with-gmp-build="$gcc_install_dir/.gmp/.build" i686-pc-linux-gnu CC='gcc -m32'
347
348 make
349
350 make check
351
352 make install
353
354 fi
355
356 cd "$here"
357 }
358
359 build_mpc()
360 {
361 if [ ! -e "$gcc_install_dir" ]; then
362 mkdir "$gcc_install_dir"
363 fi
364
365 if [ ! -e "$gcc_install_dir/.mpc" ]; then
366
367 mkdir "$gcc_install_dir/.mpc"
368
369 if [ ! -e "$gcc_install_dir/.mpc/.sources" ]; then
370 mkdir "$gcc_install_dir/.mpc/.sources"
371 fi
372
373 here="`pwd`"
374
375 cd "$gcc_install_dir/.mpc/.sources"
376
377 wget "http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz"
378
379 cd ..
380
381 rm -rf ".build"
382
383 gunzip -c ".sources/mpc-0.9.tar.gz" | tar xf -
384 mv "mpc-0.9" ".build"
385
386 cd ".build"
387
388 ./configure --prefix="$gcc_install_dir/.mpc" --with-gmp="$gcc_install_dir/.gmp" --with-mpfr="$gcc_install_dir/.mpfr" i686-pc-linux-gnu CC='gcc -m32'
389
390 make
391
392 make check
393
394 make install
395
396 fi
397
398 cd "$here"
399 }
400
401 unpack_gambit()
402 {
403 gcc_version="$1"
404
405 get_gcc_filename "$gcc_version"
406
407 if [ ! -e "$gambit_install_dir" ]; then
408 mkdir "$gambit_install_dir"
409 fi
410
411 if [ ! -e "$gambit_install_dir/$gcc_version" ]; then
412 mkdir "$gambit_install_dir/$gcc_version"
413 fi
414
415 if [ ! -e "$gambit_install_dir/$gcc_version/.build" ]; then
416
417 here="`pwd`"
418
419 cd "$gambit_install_dir/$gcc_version"
420
421 tar zxf ~/new-gambc-v4_6_5.tgz
422
423 mv gambc-v4_6_5 ".build"
424
425 cd "$here"
426
427 fi
428 }
429
430 compile_gambit()
431 {
432 gcc_version="$1"
433
434 get_gcc_filename "$gcc_version"
435
436 here="`pwd`"
437
438 cd "$gambit_install_dir/$gcc_version/.build"
439
440 echo "====================================================== $gambit_install_dir/$gcc_version/.build"
441
442 config_options="--enable-single-host --enable-c-opt=-O1"
443
444 if (./configure --prefix="$gambit_install_dir/$gcc_version/shO1" CC="$gcc_install_dir/$gcc_version/bin/gcc" $config_options && make clean && /usr/bin/time make && make install && make check) ; then
445 echo "####### $config_options VERSION BUILT SUCCESSFULLY"
446 else
447 echo "####### $config_options VERSION FAILED"
448 fi
449
450 config_options="--enable-multiple-hosts --enable-c-opt=-O1"
451
452 if (./configure --prefix="$gambit_install_dir/$gcc_version/mhO1" CC="$gcc_install_dir/$gcc_version/bin/gcc" $config_options && make clean && /usr/bin/time make && make install && make check) ; then
453 echo "####### $config_options VERSION BUILT SUCCESSFULLY"
454 else
455 echo "####### $config_options VERSION FAILED"
456 fi
457
458 config_options="--enable-single-host --enable-c-opt=-O2"
459
460 if (./configure --prefix="$gambit_install_dir/$gcc_version/shO2" CC="$gcc_install_dir/$gcc_version/bin/gcc" $config_options && make clean && /usr/bin/time make && make install && make check) ; then
461 echo "####### $config_options VERSION BUILT SUCCESSFULLY"
462 else
463 echo "####### $config_options VERSION FAILED"
464 fi
465
466 config_options="--enable-multiple-hosts --enable-c-opt=-O2"
467
468 if (./configure --prefix="$gambit_install_dir/$gcc_version/mhO2" CC="$gcc_install_dir/$gcc_version/bin/gcc" $config_options && make clean && /usr/bin/time make && make install && make check) ; then
469 echo "####### $config_options VERSION BUILT SUCCESSFULLY"
470 else
471 echo "####### $config_options VERSION FAILED"
472 fi
473
474 cd "$here"
475 }
476
477 build_gambit()
478 {
479 gcc_version="$1"
480
481 unpack_gambit "$gcc_version"
482 compile_gambit "$gcc_version"
483 }
484
485 build_all()
486 {
487 if [ ! -e "$gcc_install_dir" ]; then
488 mkdir "$gcc_install_dir"
489 fi
490
491 if [ ! -e "$gcc_install_dir/.bin" ]; then
492
493 mkdir "$gcc_install_dir/.bin"
494
495 cat <<EOF > "$gcc_install_dir/.bin/as"
496 #!/bin/sh
497 /usr/bin/as --32 \$*
498 EOF
499
500 chmod +x "$gcc_install_dir/.bin/as"
501
502 fi
503
504 export PATH="$gcc_install_dir/.bin:$PATH"
505 export LD_LIBRARY_PATH="$gcc_install_dir/.gmp/lib:$gcc_install_dir/.mpfr/lib:$gcc_install_dir/.mpc/lib:$LD_LIBRARY_PATH"
506
507 c_compiler_for_bootstrap="gcc -m32"
508
509 build_gmp
510 build_mpfr
511 build_mpc
512
513 for v in $gcc_versions ; do
514 #build_gcc "$v"
515 build_gambit "$v"
516 done
517 }
518
519 bench()
520 {
521 gcc_version="$1"
522 opt="$2"
523
524 echo "("
525 for i in 1 2 3 4 5 ; do
526 PATH="$gcc_install_dir/.bin:$PATH" $gambit_install_dir/$gcc_version/$opt/bin/gsi mix.scm > /dev/null
527 done
528 echo ")"
529
530 echo "("
531 for i in 1 2 3 4 5 ; do
532 PATH="$gcc_install_dir/.bin:$PATH" /usr/bin/time $gambit_install_dir/$gcc_version/$opt/bin/gsc -c _io.scm
533 rm -f _io.c
534 done
535 echo ")"
536
537 echo "("
538 for i in 1 2 3 4 5 ; do
539 PATH="$gcc_install_dir/.bin:$PATH" /usr/bin/time $gambit_install_dir/$gcc_version/$opt/bin/gsc _io.scm
540 rm -f _io.o*
541 done
542 echo ")"
543 }
544
545 bench_all()
546 {
547 for v in $gcc_versions ; do
548
549 echo "("
550 echo "\"$v\""
551
552 for opt in mhO1 mhO2 shO1 shO2 ; do
553
554 echo "("
555 echo "\"$opt\""
556
557 bench "$v" "$opt"
558
559 echo ")"
560
561 done
562
563 echo ")"
564
565 done
566 }
567
568 build_all
569
570 bench_all