change in the multicore version runtime. now it is able to choose which cores to...
[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"
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 elif [[ $1 = '-distributioninfo' ]]
438 then
439 JAVAOPTS="$JAVAOPTS -distributioninfo"
440 elif [[ $1 = '-disall' ]]
441 then
442 JAVAOPTS="$JAVAOPTS -disall"
443 elif [[ $1 = '-disstart' ]]
444 then
445 JAVAOPTS="$JAVAOPTS -disstart $2"
446 shift
447 elif [[ $1 = '-noc' ]]
448 then
449 CCOMPILEFLAG=false
450 elif [[ $1 = '-curdir' ]]
451 then
452 CURDIR=$2
453 shift
454 elif [[ $1 = '-outputdir' ]]
455 then
456 JAVAOPTS="$JAVAOPTS -outputdir $2"
457 shift
458 else
459 SRCFILES="$SRCFILES $1"
460 fi
461 shift
462 done
463
464 BUILDDIR="$CURDIR/$tmpbuilddirectory"
465
466 cd $1
467 cd $CURDIR
468 shift
469
470 mkdir $BUILDDIR
471
472 if $CHECKFLAG #Generate structure files for repair tool
473 then
474 JAVAOPTS="$JAVAOPTS -struct structfile"
475 fi
476
477 # Setup class path
478
479 if $RECOVERFLAG
480 then
481 if $FASTCHECK
482 then
483 #fast transactions
484 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
485 else
486 #base bristlecone files
487 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
488 fi
489 else
490 if $DSMFLAG
491 then
492 #dsm stuff
493 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
494 elif $STM
495 then
496 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
497 elif $THREADFLAG
498 then
499 #threading java stuff
500 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
501 fi
502 #base java stuff
503 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
504 fi
505
506 # Build bristlecone/java sources
507
508 if $MULTICOREFLAG
509 then
510 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
511 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
512 -dir $BUILDDIR $JAVAOPTS $SRCFILES
513 then exit $?
514 fi
515 else
516 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
517 if ! $NOJAVA
518 then
519 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
520 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
521 $JAVAOPTS $SRCFILES
522 then exit $?
523 fi
524 fi
525 fi
526
527 if $EXITAFTERANALYSIS
528 then
529 exit
530 fi
531
532 # Build all of the consistency specs
533
534 if $CHECKFLAG # CHECKFLAG
535 then
536 cd $SPECDIR
537 mkdir $BUILDDIR/specdir
538 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
539
540 echo > $BUILDDIR/specs
541
542 # compile specs into C code
543 for i in * # iterate over all directories
544 do
545 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
546 then
547 cd $SPECDIR/$i
548 cat $BUILDDIR/structfile.struct $i.label > $i.struct
549 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
550 cp size.[c,h] $BUILDDIR/specdir
551 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
552 echo $i >> $BUILDDIR/specs
553 fi # CVSDIR CHECK
554 done # iterate over all directories
555
556 #compile C code
557
558 cd $BUILDDIR/specdir
559 ./buildrobust
560 echo > $BUILDDIR/checkers.h
561 for i in `cat $BUILDDIR/specs`
562 do
563 gcc -O0 -g -fbounds-check -c $i\_aux.c
564 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
565 done
566 fi # CHECKFLAG
567
568 #build and link everything
569
570 if $RAWFLAG
571 then # RAWFLAG
572 RAWDIR="$CURDIR/raw"
573 MAKEFILE="Makefile.raw"
574 mkdir $RAWDIR
575 cd $RAWDIR
576 make clean
577 rm ./*
578
579 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
580
581 if $CACHEFLUSHFLAG
582 then # print path
583 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
584 fi
585
586 if $RAWPATHFLAG
587 then # print path
588 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
589 fi
590
591 if $DEBUGFLAG
592 then #debug version
593 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
594 fi
595
596 if $PROFILEFLAG
597 then # profile version
598 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
599 fi
600
601 if $ACCURATEPROFILEFLAG
602 then # accurateprofile version
603 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
604 fi
605
606 if $USEIOFLAG
607 then # useio version
608 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
609 fi
610
611 if $INTERRUPTFLAG
612 then #INTERRUPT version
613 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
614 fi #INTERRUPT version
615
616 if $USEIOFLAG
617 then # useio version
618 MAKEFILE="$MAKEFILE.io"
619 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
620 else
621 MAKEFILE="$MAKEFILE.$RAWCONFIG"
622 fi #useio version
623
624 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
625 cp ../Runtime/*.c ./
626 cp ../Runtime/*.h ./
627 cp ../Runtime/*.S ./
628 cp ../Runtime/*.s ./
629 cp ../Runtime/RAW/*.c ./
630 cp ../Runtime/RAW/*.h ./
631 cp ../Runtime/RAW/*.S ./
632 cp ../Runtime/RAW/*.s ./
633 cp ../$tmpbuilddirectory/*.c ./
634 cp ../$tmpbuilddirectory/*.h ./
635
636 make
637
638 elif $TILERAFLAG
639 then # TILERAFLAG
640 TILERADIR="$CURDIR/tilera"
641 MAKEFILE="Makefile.tilera.$TILERACONFIG"
642 SIMHVC="sim.hvc.$TILERACONFIG"
643 PCIHVC="pci.hvc.$TILERACONFIG"
644 mkdir $TILERADIR
645 cd $TILERADIR
646 make clean
647 rm ./*
648
649 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
650
651 if $CACHEFLUSHFLAG
652 then # print path
653 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
654 fi
655
656 if $RAWPATHFLAG
657 then # print path
658 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
659 fi
660
661 if $DEBUGFLAG
662 then #debug version
663 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
664 fi
665
666 if $PROFILEFLAG
667 then # profile version
668 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
669 fi
670
671 if $ACCURATEPROFILEFLAG
672 then # accurateprofile version
673 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
674 fi
675
676 if $USEIOFLAG
677 then # useio version
678 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
679 fi
680
681 if $INTERRUPTFLAG
682 then #INTERRUPT version
683 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
684 fi #INTERRUPT version
685
686 if $MULTICOREGCFLAG
687 then #MULTICOREGC version
688 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
689 fi
690
691 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
692 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
693 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
694 cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
695 cp ../Runtime/multicoretask.c ./
696 cp ../Runtime/multicoreruntime.c ./
697 cp ../Runtime/Queue.c ./
698 cp ../Runtime/file.c ./
699 cp ../Runtime/math.c ./
700 cp ../Runtime/object.c ./
701 cp ../Runtime/GenericHashtable.c ./
702 cp ../Runtime/SimpleHash.c ./
703 cp ../Runtime/ObjectHash.c ./
704 cp ../Runtime/socket.c ./
705 cp ../Runtime/mem.c ./
706 cp ../Runtime/multicoregarbage.c ./
707 cp ../Runtime/GenericHashtable.h ./
708 cp ../Runtime/mem.h ./
709 cp ../Runtime/multicoreruntime.h ./
710 cp ../Runtime/object.h ./
711 cp ../Runtime/ObjectHash.h ./
712 cp ../Runtime/Queue.h ./
713 cp ../Runtime/runtime.h ./
714 cp ../Runtime/SimpleHash.h ./
715 cp ../Runtime/multicoregc.h ./
716 cp ../Runtime/multicoregarbage.h ./
717 cp ../Runtime/multicorehelper.h ./
718 cp ../Tilera/Runtime/*.c ./
719 cp ../Tilera/Runtime/*.h ./
720 cp ../Tilera/lib/* ./
721 cp ../$tmpbuilddirectory/*.c ./
722 cp ../$tmpbuilddirectory/*.h ./
723
724 make
725
726 else #!RAWFLAG && !TILERAFLAG
727 cd $CURDIR 
728
729 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
730 -I$BUILDDIR"
731
732 if $MULTICOREFLAG
733 then
734 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
735 else
736 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
737 fi
738
739 FILES="$RUNTIMEFILE \
740 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
741 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
742 $ROBUSTROOT/Runtime/ObjectHash.c \
743 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
744 $ROBUSTROOT/Runtime/math.c \
745 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
746
747 if $NUMA
748 then
749 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"
750 fi
751
752 if $EVENTMONITOR
753 then
754 FILES="$FILES $ROBUSTROOT/Runtime/STM/monitor.c"
755 fi
756
757 if $FASTMEMCPY
758 then
759 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
760 fi
761
762 if $DSMFLAG
763 then
764 if $DSMRECOVERY
765 then
766 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
767 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"
768 else
769 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
770 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"
771 fi
772 fi
773 if $STM
774 then
775 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
776 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/stm.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c $STMRUNTIME/stats.c $STMRUNTIME/commit.c $STMRUNTIME/objstr.c"
777 fi
778
779 if $SANDBOX
780 then
781 FILES="$FILES $STMRUNTIME/sandbox.c"
782 fi
783
784 if $ABORTREADERS
785 then
786 FILES="$FILES $DSMRUNTIME/abortreaders.c"
787 fi
788
789 if $FASTCHECK
790 then
791 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
792 fi
793
794 if $MLP_ON
795 then
796 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
797 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
798 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
799 fi
800
801 if $RECOVERFLAG
802 then
803 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
804 if $MULTICOREFLAG
805 then
806 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
807 fi
808 FILES="$FILES $tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
809 if $RAWFLAG
810 then
811 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
812 fi
813 if $THREADSIMULATEFLAG
814 then
815 # -lpthread for pthread functions, -lrt for message queue functions
816 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
817 fi
818 fi
819
820 if $OPTIONALFLAG
821 then
822 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
823 FILES="$FILES $tmpbuilddirectory/optionalarrays.c"
824 fi
825
826 if $THREADFLAG
827 then
828 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
829 fi
830
831 if $CHECKFLAG
832 then
833 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
834 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
835 fi
836
837 if $USEDMALLOC
838 then
839 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
840 fi
841
842 if $ASSEMBLY
843 then
844 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
845 -c $tmpbuilddirectory/methods.c -lm
846 fi
847
848 if $MULTICOREFLAG
849 then
850 gcc $INCLUDES $EXTRAOPTIONS \
851 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
852 else
853 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
854 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
855 fi
856
857 fi #!RAWFLAG
858
859
860 exit
861