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