Statically ping memory from the nearest memory controller on the cores
[IRC.git] / Robust / src / buildscript
1 #!/bin/bash
2
3 printhelp() {
4 echo STM Options
5 echo -singleTM single machine committing transactions
6 echo -stmdebug STM debug
7 echo "-stmstats prints single machine commit (stm) statistics for the benchmark"
8 echo -fastmemcpy use fast memcpy
9 echo -sandbox sandbox transactions
10 echo -dcopts conflict optimizations for transactional memory
11 echo -transstats generates transaction stats on commits and aborts
12 echo -inlineatomic depth inline methods inside of transactions to specified depth
13 echo "-stmarray partial array treatment"
14 echo "-dualview dual view of arrays"
15 echo "-hybrid use fission only when it looks like a good choice"
16 echo "-numa numa aware"
17 echo "-eventmonitor turn on transaction event trace recording"
18 echo
19 echo DSM options
20 echo -dsm distributed shared memory
21 echo -abortreaders abort readers immediately
22 echo -trueprob double - probabiltiy of true branch
23 echo -dsmcaching -enable caching in dsm runtime
24 echo
25 echo BAMBOO Multicore options
26 echo -scheduling do task scheduling
27 echo -multicore generate multi-core version binary
28 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
29 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
30 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
31 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
32 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
33 echo -printscheduling print out scheduling graphs
34 echo -printschedulesim print out scheduling simulator result graphs
35 echo -abcclose close the array boundary check
36 echo "-tilera_bme generate tilera version binary for Bare Mental Environment (should be used together with -multicore"
37 echo "-tilera_zlinux generate tilera version binary for Zero-Overhead Linux with multi-process mode (should be used together with -multicore"
38 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
39 echo "-raw generate raw version binary (should be used together with -multicore)"
40 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
41 echo -multicoregc generate multi-core binary with garbage collection
42 echo "-numcore4gc set the number of cores for gc (should be used together with -multicoregc), defaultly set as 0"
43 echo -gcprofile build with gcprofile options
44 echo -accurateprofile build with accurate profile information including pre/post task processing info
45 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
46 echo
47 echo Other options
48 echo -builddir setup different build directory
49 echo -robustroot set up the ROBUSTROOT to directory other than default one
50 echo -readset turn on readset
51 echo -mac distributed shared memory mac support
52 echo -check generate check code
53 echo -dmalloc link in dmalloc
54 echo -64bit compile for 64 bit machine
55 echo -32bit compile for 32 bit machine
56 echo -joptimize java compiler optimizations
57 echo -recover compile task code
58 echo -fastcheck fast checkpointing for Bristlecone
59 echo -specdir directory
60 echo -printflat print out flat representation
61 echo -selfloop task - this task cannot self loop forever
62 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
63 echo -taskstate do task state analysis
64 echo -tagstate do tag state analysis
65 echo -optional enable optional
66 echo -debug generate debug symbols
67 echo -prefetch do prefetch analysis
68 echo -garbagestats Print garbage collection statistics
69 echo -webinterface enable web interface
70 echo -runtimedebug printout runtime debug messages
71 echo "-thread use support for multiple threads"
72 echo "-optimize call gcc with -O9 (optimize)"
73 echo "-nooptimize call gcc with -O0 (do not optimize)"
74 echo -curdir directory 
75 echo -mainclass class with main method
76 echo -o binary
77 echo -nojava do not run bristlecone compiler
78 echo -instructionfailures inject code for instructionfailures
79 echo -profile build with profile options
80 echo "-enable-assertions execute assert statements during compilation"
81 echo -justanalyze exit after compiler analyses complete
82 echo "-distributioninfo  execute to collect distribution info for simulated annealing in multi-core version"
83 echo "-disall  execute to collect whole distribution"
84 echo "-disstart specify the start number of distribution information collection"
85 echo -assembly generate assembly
86 echo -recovery compile recovery code
87 echo -dsmtask support work and task class library
88 echo -recoverystats print out recovery record 
89 echo -help help
90 }
91
92 tmpbuilddirectory="tmpbuilddirectory"
93 NUMA=false;
94 SANDBOX=false;
95 ABORTREADERS=false;
96 ROBUSTROOT=~/research/Robust/src
97 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
98 STMRUNTIME=$ROBUSTROOT/Runtime/STM/
99 DSMRECOVERYRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface_recovery/
100 REPAIRROOT=~/research/Repair/RepairCompiler/
101 CURDIR=`pwd`
102 DSMFLAG=false
103 DSMRECOVERY=false
104 FASTMEMCPY=false
105 STMARRAY=false
106 DUALVIEW=false
107 STM=false
108 EVENTMONITOR=false
109 NOJAVA=false
110 CHECKFLAG=false
111 RECOVERFLAG=false
112 MLP_ON=false
113 MLPDEBUG=false
114 MULTICOREFLAG=false
115 RAWFLAG=false
116 TILERAFLAG=false
117 TILERABMEFLAG=false
118 TILERAZLINUXFLAG=false
119 TILERACONFIG=''
120 CACHEFLUSHFLAG=false
121 RAWCONFIG=''
122 DEBUGFLAG=false
123 RAWPATHFLAG=false
124 PROFILEFLAG=false
125 GCPROFILEFLAG=false
126 ACCURATEPROFILEFLAG=false
127 USEIOFLAG=false
128 INTERRUPTFLAG=false
129 THREADSIMULATEFLAG=false;
130 MULTICOREGCFLAG=false;
131 USEDMALLOC=false
132 THREADFLAG=false
133 FASTCHECK=false
134 SPECDIR=`pwd`
135 SRCFILES=''
136 EXTRAOPTIONS=''
137 MAINFILE='a'
138 JAVAFORWARDOPTS=''
139 JAVAOPTS=''
140 OPTIONALFLAG=false
141 EXITAFTERANALYSIS=false
142 ASSEMBLY=false
143 GCCORES=''
144
145 if [[ -z $1 ]]
146 then
147 printhelp
148 exit
149 fi
150
151 while [[ -n $1 ]]
152 do
153 if [[ $1 = '-help' ]]
154 then
155 printhelp
156 exit
157 elif [[ $1 = '-justanalyze' ]]
158 then
159 EXITAFTERANALYSIS=true
160 elif [[ $1 = '-assembly' ]]
161 then
162 ASSEMBLY=true
163 elif [[ $1 = '-abortreaders' ]]
164 then
165 ABORTREADERS=true
166 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
167 JAVAOPTS="$JAVAOPTS -abortreaders"
168 elif [[ $1 = '-sandbox' ]]
169 then
170 SANDBOX=true
171 EXTRAOPTIONS="$EXTRAOPTIONS -DSANDBOX"
172 JAVAOPTS="$JAVAOPTS -sandbox"
173 elif [[ $1 = '-numa' ]]
174 then
175 EXTRAOPTIONS="$EXTRAOPTIONS -DAFFINITY -D_GNU_SOURCE"
176 NUMA=true
177 elif [[ $1 = '-robustroot' ]]
178 then
179 ROBUSTROOT="$2"
180 shift
181 elif [[ $1 = '-builddir' ]]
182 then
183 tmpbuilddirectory="$2"
184 shift
185 elif [[ $1 = '-nojava' ]]
186 then
187 NOJAVA=true
188 elif [[ $1 = '-eventmonitor' ]]
189 then
190 JAVAOPTS="$JAVAOPTS -eventmonitor"
191 EVENTMONITOR=true
192 EXTRAOPTIONS="$EXTRAOPTIONS -DEVENTMONITOR"
193 elif [[ $1 = '-garbagestats' ]]
194 then
195 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
196 elif [[ $1 = '-64bit' ]]
197 then
198 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64 -m64"
199 elif [[ $1 = '-32bit' ]]
200 then
201 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
202 elif [[ $1 = '-fastcheck' ]]
203 then
204 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
205 JAVAOPTS="$JAVAOPTS -fastcheck"
206 FASTCHECK=true
207 elif [[ $1 = '-o' ]]
208 then
209 MAINFILE="$2"
210 shift
211 elif [[ $1 = '-mainclass' ]]
212 then
213 JAVAOPTS="$JAVAOPTS -mainclass $2"
214 shift
215 elif [[ $1 = '-selfloop' ]]
216 then
217 JAVAOPTS="$JAVAOPTS -selfloop $2"
218 shift
219 elif [[ $1 = '-excprefetch' ]]
220 then
221 JAVAOPTS="$JAVAOPTS -excprefetch $2"
222 shift
223 elif [[ $1 = '-arraypad' ]]
224 then
225 JAVAOPTS="$JAVAOPTS -arraypad"
226 elif [[ $1 = '-dsm' ]]
227 then
228 JAVAOPTS="$JAVAOPTS -dsm"
229 DSMFLAG=true
230 elif [[ $1 = '-fastmemcpy' ]]
231 then
232 FASTMEMCPY=true
233 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
234 elif [[ $1 = '-singleTM' ]]
235 then
236 JAVAOPTS="$JAVAOPTS -singleTM"
237 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
238 STM=true
239 elif [[ $1 = '-stmarray' ]]
240 then
241 JAVAOPTS="$JAVAOPTS -stmarray"
242 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMARRAY"
243 STMARRAY=true
244 elif [[ $1 = '-dualview' ]]
245 then
246 JAVAOPTS="$JAVAOPTS -dualview"
247 EXTRAOPTIONS="$EXTRAOPTIONS -DDUALVIEW"
248 DUALVIEW=true
249 elif [[ $1 = '-readset' ]]
250 then
251 JAVAOPTS="$JAVAOPTS -readset"
252 EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET"
253 elif [[ $1 = '-stmdebug' ]]
254 then
255 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
256 elif [[ $1 = '-stmstats' ]]
257 then
258 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
259 elif [[ $1 = '-stmlog' ]]
260 then
261 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMLOG"
262 elif [[ $1 = '-prefetch' ]]
263 then
264 JAVAOPTS="$JAVAOPTS -prefetch"
265 elif [[ $1 = '-transstats' ]]
266 then
267 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
268 elif [[ $1 = '-printflat' ]]
269 then
270 JAVAOPTS="$JAVAOPTS -printflat"
271 elif [[ $1 = '-trueprob' ]]
272 then
273 JAVAOPTS="$JAVAOPTS -trueprob $2"
274 shift
275 elif [[ $1 = '-inlineatomic' ]]
276 then
277 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
278 shift
279 elif [[ $1 = '-mac' ]]
280 then
281 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
282 elif [[ $1 = '-profile' ]]
283 then
284 PROFILEFLAG=true
285 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
286 elif [[ $1 = '-gcprofile' ]]
287 then
288 GCPROFILEFLAG=true
289 elif [[ $1 = '-accurateprofile' ]]
290 then
291 ACCURATEPROFILEFLAG=true
292 elif [[ $1 = '-useio' ]]
293 then
294 USEIOFLAG=true
295 elif [[ $1 = '-taskstate' ]]
296 then
297 JAVAOPTS="$JAVAOPTS -taskstate"
298 elif [[ $1 = '-tagstate' ]]
299 then
300 JAVAOPTS="$JAVAOPTS -tagstate"
301 elif [[ $1 = '-scheduling' ]]
302 then
303 JAVAOPTS="$JAVAOPTS -scheduling"
304 elif [[ $1 = '-multicore' ]]
305 then
306 MULTICOREFLAG=true
307 JAVAOPTS="$JAVAOPTS -multicore"
308 elif [[ $1 = '-numcore' ]]
309 then
310 JAVAOPTS="$JAVAOPTS -numcore $2"
311 shift
312 elif [[ $1 = '-numcore4gc' ]]
313 then
314 JAVAOPTS="$JAVAOPTS -numcore4gc $2"
315 GCCORES="GC_$2"
316 shift
317 elif [[ $1 = '-raw' ]]
318 then
319 RAWFLAG=true
320 JAVAOPTS="$JAVAOPTS -raw"
321 elif [[ $1 = '-tilera_bme' ]]
322 then
323 TILERAFLAG=true
324 TILERABMEFLAG=true
325 elif [[ $1 = '-tilera_zlinux' ]]
326 then
327 TILERAFLAG=true
328 TILERAZLINUXFLAG=true
329 elif [[ $1 = '-tileraconfig' ]]
330 then
331 TILERACONFIG="$2"
332 shift
333 elif [[ $1 = '-cacheflush' ]]
334 then
335 CACHEFLUSHFLAG=true
336 elif [[ $1 = '-rawconfig' ]]
337 then
338 RAWCONFIG="$2"
339 shift
340 elif [[ $1 = '-interrupt' ]]
341 then
342 INTERRUPTFLAG=true
343 elif [[ $1 = '-abcclose' ]]
344 then
345 JAVAOPTS="$JAVAOPTS -abcclose"
346 elif [[ $1 = '-optional' ]]
347 then
348 JAVAOPTS="$JAVAOPTS -optional"
349 OPTIONALFLAG=true
350 elif [[ $1 = '-multicoregc' ]]
351 then
352 MULTICOREGCFLAG=true
353 JAVAOPTS="$JAVAOPTS -multicoregc"
354 elif [[ $1 = '-dmalloc' ]]
355 then
356 USEDMALLOC=true
357 elif [[ $1 = '-recover' ]]
358 then
359 RECOVERFLAG=true
360 JAVAOPTS="$JAVAOPTS -task"
361 elif [[ $1 = '-useprofile' ]]
362 then
363 JAVAOPTS="$JAVAOPTS -useprofile $2"
364 shift
365 elif [[ $1 = '-webinterface' ]]
366 then
367 JAVAOPTS="$JAVAOPTS -webinterface"
368 elif [[ $1 = '-instructionfailures' ]]
369 then
370 JAVAOPTS="$JAVAOPTS -instructionfailures"
371 elif [[ $1 = '-joptimize' ]]
372 then
373 JAVAOPTS="$JAVAOPTS -optimize"
374 elif [[ $1 = '-dcopts' ]]
375 then
376 JAVAOPTS="$JAVAOPTS -dcopts"
377 elif [[ $1 = '-delaycomp' ]]
378 then
379 JAVAOPTS="$JAVAOPTS -delaycomp"
380 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
381 elif [[ $1 = '-hybrid' ]]
382 then
383 JAVAOPTS="$JAVAOPTS -hybrid"
384 EXTRAOPTIONS="$EXTRAOPTIONS -DHYBRID"
385 elif [[ $1 = '-minimize' ]]
386 then
387 JAVAOPTS="$JAVAOPTS -minimize"
388
389 elif [[ $1 = '-mlp' ]]
390 then
391 MLP_ON=true
392 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
393 JAVAOPTS="$JAVAOPTS -mlp $2 $3"
394 shift
395 shift
396
397 elif [[ $1 = '-mlpdebug' ]]
398 then
399 JAVAOPTS="$JAVAOPTS -mlpdebug"
400
401 elif [[ $1 = '-check' ]]
402 then
403 CHECKFLAG=true
404 JAVAOPTS="$JAVAOPTS -conscheck"
405 elif [[ $1 = '-enable-assertions' ]]
406 then
407 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
408 elif [[ $1 = '-specdir' ]]
409 then
410 cd $2
411 SPECDIR=`pwd`
412 cd $CURDIR
413 shift
414 elif [[ $1 = '-debug' ]]
415 then
416 DEBUGFLAG=true
417 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
418 elif [[ $1 = '-rawpath' ]]
419 then
420 RAWPATHFLAG=true
421 elif [[ $1 = '-runtimedebug' ]]
422 then
423 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
424 elif [[ $1 = '-dsmcaching' ]]
425 then
426 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
427 elif [[ $1 = '-rangeprefetch' ]]
428 then
429 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
430 elif [[ $1 = '-nooptimize' ]]
431 then
432 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
433 elif [[ $1 = '-optimize' ]]
434 then
435 EXTRAOPTIONS="$EXTRAOPTIONS -O3"
436 elif [[ $1 = '-thread' ]]
437 then
438 JAVAOPTS="$JAVAOPTS -thread"
439 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
440 THREADFLAG=true
441 elif [[ $1 = '-recovery' ]]
442 then
443 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERY"
444 DSMRECOVERY=true
445 elif [[ $1 = '-recoverystats' ]]
446 then
447 JAVAOPTS="$JAVAOPTS -recoverystats"
448 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERYSTATS"
449 elif [[ $1 = '-distributioninfo' ]]
450 then
451 JAVAOPTS="$JAVAOPTS -distributioninfo"
452 elif [[ $1 = '-disall' ]]
453 then
454 JAVAOPTS="$JAVAOPTS -disall"
455 elif [[ $1 = '-disstart' ]]
456 then
457 JAVAOPTS="$JAVAOPTS -disstart $2"
458 shift
459 elif [[ $1 = '-noc' ]]
460 then
461 CCOMPILEFLAG=false
462 elif [[ $1 = '-curdir' ]]
463 then
464 CURDIR=$2
465 shift
466 elif [[ $1 = '-outputdir' ]]
467 then
468 JAVAOPTS="$JAVAOPTS -outputdir $2"
469 shift
470 else
471 SRCFILES="$SRCFILES $1"
472 fi
473 shift
474 done
475
476 BUILDDIR="$CURDIR/$tmpbuilddirectory"
477
478 cd $1
479 cd $CURDIR
480 shift
481
482 mkdir $BUILDDIR
483
484 if $CHECKFLAG #Generate structure files for repair tool
485 then
486 JAVAOPTS="$JAVAOPTS -struct structfile"
487 fi
488
489 # Setup class path
490
491 if $RECOVERFLAG
492 then
493 if $FASTCHECK
494 then
495 #fast transactions
496 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
497 else
498 #base bristlecone files
499 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
500 fi
501 else
502 if $DSMFLAG
503 then
504 #dsm stuff
505 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
506 elif $STM
507 then
508 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
509 elif $THREADFLAG
510 then
511 #threading java stuff
512 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
513 fi
514 #base java stuff
515 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
516 fi
517
518 # Build bristlecone/java sources
519
520 if $MULTICOREFLAG
521 then
522 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
523 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
524 -dir $BUILDDIR $JAVAOPTS $SRCFILES
525 then exit $?
526 fi
527 else
528 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
529 if ! $NOJAVA
530 then
531 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
532 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
533 $JAVAOPTS $SRCFILES
534 then exit $?
535 fi
536 fi
537 fi
538
539 if $EXITAFTERANALYSIS
540 then
541 exit
542 fi
543
544 # Build all of the consistency specs
545
546 if $CHECKFLAG # CHECKFLAG
547 then
548 cd $SPECDIR
549 mkdir $BUILDDIR/specdir
550 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
551
552 echo > $BUILDDIR/specs
553
554 # compile specs into C code
555 for i in * # iterate over all directories
556 do
557 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
558 then
559 cd $SPECDIR/$i
560 cat $BUILDDIR/structfile.struct $i.label > $i.struct
561 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
562 cp size.[c,h] $BUILDDIR/specdir
563 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
564 echo $i >> $BUILDDIR/specs
565 fi # CVSDIR CHECK
566 done # iterate over all directories
567
568 #compile C code
569
570 cd $BUILDDIR/specdir
571 ./buildrobust
572 echo > $BUILDDIR/checkers.h
573 for i in `cat $BUILDDIR/specs`
574 do
575 gcc -O0 -g -fbounds-check -c $i\_aux.c
576 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
577 done
578 fi # CHECKFLAG
579
580 #build and link everything
581
582 if $RAWFLAG
583 then # RAWFLAG
584 RAWDIR="$CURDIR/raw"
585 MAKEFILE="Makefile.raw"
586 mkdir $RAWDIR
587 cd $RAWDIR
588 make clean
589 rm ./*
590
591 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
592
593 if $CACHEFLUSHFLAG
594 then # print path
595 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
596 fi
597
598 if $RAWPATHFLAG
599 then # print path
600 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
601 fi
602
603 if $DEBUGFLAG
604 then #debug version
605 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
606 fi
607
608 if $PROFILEFLAG
609 then # profile version
610 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
611 fi
612
613 if $ACCURATEPROFILEFLAG
614 then # accurateprofile version
615 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
616 fi
617
618 if $USEIOFLAG
619 then # useio version
620 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
621 fi
622
623 if $INTERRUPTFLAG
624 then #INTERRUPT version
625 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
626 fi #INTERRUPT version
627
628 if $USEIOFLAG
629 then # useio version
630 MAKEFILE="$MAKEFILE.io"
631 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
632 else
633 MAKEFILE="$MAKEFILE.$RAWCONFIG"
634 fi #useio version
635
636 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
637 cp ../Runtime/*.c ./
638 cp ../Runtime/*.h ./
639 cp ../Runtime/*.S ./
640 cp ../Runtime/*.s ./
641 cp ../Runtime/RAW/*.c ./
642 cp ../Runtime/RAW/*.h ./
643 cp ../Runtime/RAW/*.S ./
644 cp ../Runtime/RAW/*.s ./
645 cp ../$tmpbuilddirectory/*.c ./
646 cp ../$tmpbuilddirectory/*.h ./
647
648 make
649
650 elif $TILERAFLAG
651 then # TILERAFLAG
652 TILERADIR="$CURDIR/tilera"
653 if $TILERABMEFLAG
654 then # TILERABMEFLAG
655 TILERA_INDIR="BME"
656 MAKEFILE="Makefile.tilera.$TILERACONFIG"
657 SIMHVC="sim.hvc.$TILERACONFIG"
658 PCIHVC="pci.hvc.$TILERACONFIG"
659 elif $TILERAZLINUXFLAG
660 then # TILERAZLINUXFLAG
661 TILERA_INDIR="ZLinux"
662 MAKEFILE="Makefile.tilera.$TILERACONFIG"
663 fi
664 mkdir $TILERADIR
665 cd $TILERADIR
666 make clean
667 rm ./*
668
669 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
670
671 if $TILERABMEFLAG
672 then # TILERABMEFLAG
673 TILERACFLAGS="${TILERACFLAGS} -DTILERA_BME"
674 elif $TILERAZLINUXFLAG
675 then # TILERAZLINUXFLAG
676 TILERACFLAGS="${TILERACFLAGS} -DTILERA_ZLINUX"
677 fi
678
679 if $CACHEFLUSHFLAG
680 then # print path
681 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
682 fi
683
684 if $RAWPATHFLAG
685 then # print path
686 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
687 fi
688
689 if $DEBUGFLAG
690 then #debug version
691 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
692 fi
693
694 if $PROFILEFLAG
695 then # profile version
696 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
697 fi
698
699 if $ACCURATEPROFILEFLAG
700 then # accurateprofile version
701 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
702 fi
703
704 if $USEIOFLAG
705 then # useio version
706 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
707 fi
708
709 if $INTERRUPTFLAG
710 then #INTERRUPT version
711 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
712 fi #INTERRUPT version
713
714 if $MULTICOREGCFLAG
715 then #MULTICOREGC version
716 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
717 fi
718
719 if $GCPROFILEFLAG
720 then # GC_PROFILE version
721 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE"
722 fi
723
724 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
725 if $TILERABMEFLAG
726 then # TILERABMEFLAG
727 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
728 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc
729 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
730 fi
731 cp ../Runtime/multicoretask.c ./
732 cp ../Runtime/multicoreruntime.c ./
733 cp ../Runtime/Queue.c ./
734 cp ../Runtime/file.c ./
735 cp ../Runtime/math.c ./
736 cp ../Runtime/object.c ./
737 cp ../Runtime/GenericHashtable.c ./
738 cp ../Runtime/SimpleHash.c ./
739 cp ../Runtime/GCSharedHash.c ./
740 cp ../Runtime/ObjectHash.c ./
741 cp ../Runtime/socket.c ./
742 cp ../Runtime/mem.c ./
743 cp ../Runtime/multicoregarbage.c ./
744 cp ../Runtime/MGCHash.c ./
745 cp ../Runtime/GenericHashtable.h ./
746 cp ../Runtime/mem.h ./
747 cp ../Runtime/multicoreruntime.h ./
748 cp ../Runtime/object.h ./
749 cp ../Runtime/ObjectHash.h ./
750 cp ../Runtime/Queue.h ./
751 cp ../Runtime/runtime.h ./
752 cp ../Runtime/SimpleHash.h ./
753 cp ../Runtime/GCSharedHash.h ./
754 cp ../Runtime/multicoregc.h ./
755 cp ../Runtime/multicoregarbage.h ./
756 cp ../Runtime/multicorehelper.h ./
757 cp ../Runtime/MGCHash.h ./
758 cp ../Tilera/Runtime/*.c ./
759 cp ../Tilera/Runtime/*.h ./
760 cp ../Tilera/Runtime/$TILERA_INDIR/*.c ./
761 cp ../Tilera/Runtime/$TILERA_INDIR/*.h ./
762 if $TILERAZLINUXFLAG
763 then # TILERAZLINUXFLAG
764 cp ../Tilera/Runtime/$TILERA_INDIR/*.S ./
765 fi
766 cp ../Tilera/lib/* ./
767 cp ../$tmpbuilddirectory/*.c ./
768 cp ../$tmpbuilddirectory/*.h ./
769
770 make
771
772 else #!RAWFLAG && !TILERABMEFLAG  && ! TILERAZLINUXFLAG
773 cd $CURDIR 
774
775 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
776 -I$BUILDDIR"
777
778 if $MULTICOREFLAG
779 then
780 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
781 else
782 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
783 fi
784
785 FILES="$RUNTIMEFILE \
786 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
787 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
788 $ROBUSTROOT/Runtime/ObjectHash.c \
789 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
790 $ROBUSTROOT/Runtime/math.c \
791 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
792
793 if $NUMA
794 then
795 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"
796 fi
797
798 if $EVENTMONITOR
799 then
800 FILES="$FILES $ROBUSTROOT/Runtime/STM/monitor.c"
801 fi
802
803 if $FASTMEMCPY
804 then
805 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
806 fi
807
808 if $DSMFLAG
809 then
810 if $DSMRECOVERY
811 then
812 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
813 FILES="$FILES $DSMRECOVERYRUNTIME/trans.c $DSMRECOVERYRUNTIME/mcpileq.c $DSMRECOVERYRUNTIME/objstr.c $DSMRECOVERYRUNTIME/dstm.c $DSMRECOVERYRUNTIME/altmlookup.c $DSMRECOVERYRUNTIME/clookup.c $DSMRECOVERYRUNTIME/llookup.c $DSMRECOVERYRUNTIME/tlookup.c $DSMRECOVERYRUNTIME/threadnotify.c $DSMRECOVERYRUNTIME/dstmserver.c $DSMRECOVERYRUNTIME/plookup.c $DSMRECOVERYRUNTIME/ip.c $DSMRECOVERYRUNTIME/queue.c $DSMRECOVERYRUNTIME/altprelookup.c $DSMRECOVERYRUNTIME/machinepile.c $ROBUSTROOT/Runtime/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRECOVERYRUNTIME/sockpool.c $DSMRECOVERYRUNTIME/addUdpEnhance.c $DSMRECOVERYRUNTIME/signal.c $DSMRECOVERYRUNTIME/gCollect.c $DSMRECOVERYRUNTIME/addPrefetchEnhance.c $DSMRECOVERYRUNTIME/dsmlock.c $DSMRECOVERYRUNTIME/translist.c $DSMRECOVERYRUNTIME/paxos.c"
814 else
815 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
816 FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/altprelookup.c $DSMRUNTIME/machinepile.c $ROBUSTROOT/Runtime/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c $DSMRUNTIME/dsmlock.c $DSMRUNTIME/prefetch.c $DSMRUNTIME/altmlookup.c"
817 fi
818 fi
819
820 if $STM
821 then
822 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
823 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/stm.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c $STMRUNTIME/stats.c $STMRUNTIME/commit.c $STMRUNTIME/objstr.c"
824 fi
825
826 if $SANDBOX
827 then
828 if $DSMFLAG
829 then
830 FILES="$FILES $DSMRUNTIME/sandbox.c"
831 else
832 FILES="$FILES $STMRUNTIME/sandbox.c"
833 fi
834 fi
835
836 if $ABORTREADERS
837 then
838 FILES="$FILES $DSMRUNTIME/abortreaders.c"
839 fi
840
841 if $FASTCHECK
842 then
843 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
844 fi
845
846 if $MLP_ON
847 then
848 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
849 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
850 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
851 fi
852
853 if $RECOVERFLAG
854 then
855 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
856 if $MULTICOREFLAG
857 then
858 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
859 fi
860 FILES="$FILES $tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
861 if $RAWFLAG
862 then
863 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
864 fi
865 if $THREADSIMULATEFLAG
866 then
867 # -lpthread for pthread functions, -lrt for message queue functions
868 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
869 fi
870 fi
871
872 if $OPTIONALFLAG
873 then
874 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
875 FILES="$FILES $tmpbuilddirectory/optionalarrays.c"
876 fi
877
878 if $THREADFLAG
879 then
880 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
881 fi
882
883 if $CHECKFLAG
884 then
885 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
886 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
887 fi
888
889 if $USEDMALLOC
890 then
891 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
892 fi
893
894 if $ASSEMBLY
895 then
896 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
897 -c $tmpbuilddirectory/methods.c -lm
898 fi
899
900 if $MULTICOREFLAG
901 then
902 gcc $INCLUDES $EXTRAOPTIONS \
903 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
904 else
905 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
906 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
907 fi
908
909 fi #!RAWFLAG
910
911
912 exit
913