getting close to mlp running a limited program
[IRC.git] / Robust / src / buildscript
index bd4928ed58a52a641033fc7201b9c638175bae31..0b827e40b8689715b11a87a69cc9a744428732f7 100755 (executable)
@@ -3,12 +3,19 @@
 printhelp() {
 echo -robustroot set up the ROBUSTROOT to directory other than default one
 echo -dsm distributed shared memory
+echo -singleTM single machine committing transactions
+echo -stmdebug STM debug
+echo "-stmstats prints single machine commit (stm) statistics for the benchmark"
+echo -fastmemcpy use fast memcpy
 echo -abortreaders abort readers immediately
 echo -trueprob double - probabiltiy of true branch
 echo -dsmcaching -enable caching in dsm runtime
 echo -mac distributed shared memory mac support
 echo -check generate check code
 echo -dmalloc link in dmalloc
+echo -64bit compile for 64 bit machine
+echo -joptimize java compiler optimizations
+echo -dcopts conflict optimizations for transactional memory
 echo -recover compile task code
 echo -fastcheck fast checkpointing for Bristlecone
 echo -specdir directory
@@ -20,19 +27,23 @@ echo -tagstate do tag state analysis
 echo -scheduling do task scheduling
 echo -multicore generate multi-core version binary
 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
-echo "-raw generate raw version binary (should be used together with -multicore)"
-echo "-rawcacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
+echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
-echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
-echo -threadsimulate generate multi-thread simulate version binary
 echo -printscheduling print out scheduling graphs
 echo -printschedulesim print out scheduling simulator result graphs
+echo -abcclose close the array boundary check
+echo "-tilera generate tilera version binary (should be used together with -multicore"
+echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
+echo "-raw generate raw version binary (should be used together with -multicore)"
+echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
+echo -threadsimulate generate multi-thread simulate version binary
 echo -optional enable optional
 echo -debug generate debug symbols
 echo -prefetch do prefetch analysis
 echo -transstats generates transaction stats on commits and aborts
+echo -garbagestats Print garbage collection statistics
 echo -webinterface enable web interface
 echo -runtimedebug printout runtime debug messages
 echo "-thread use support for multiple threads"
@@ -44,29 +55,35 @@ echo -o binary
 echo -nojava do not run bristlecone compiler
 echo -instructionfailures inject code for instructionfailures
 echo -profile build with profile options
-echo "-rawuseio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
+echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
 echo "-enable-assertions execute assert statements during compilation"
 echo -justanalyze exit after compiler analyses complete
 echo -help help
 }
 
+ABORTREADERS=false;
 ROBUSTROOT=~/research/Robust/src
 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
 REPAIRROOT=~/research/Repair/RepairCompiler/
 CURDIR=`pwd`
 DSMFLAG=false
+FASTMEMCPY=false
+SINGLETM=false
 NOJAVA=false
 CHECKFLAG=false
 RECOVERFLAG=false
+MLPFLAG=false
+MLPDEBUG=false
 MULTICOREFLAG=false
-TRANSSTATSFLAG=false
 RAWFLAG=false
-RAWCACHEFLUSHFLAG=false
+TILERAFLAG=false
+TILERACONFIG=''
+CACHEFLUSHFLAG=false
 RAWCONFIG=''
-RAWDEBUGFLAG=false
+DEBUGFLAG=false
 RAWPATHFLAG=false
-RAWPROFILEFLAG=false
-RAWUSEIOFLAG=false
+PROFILEFLAG=false
+USEIOFLAG=false
 INTERRUPTFLAG=false
 THREADSIMULATEFLAG=false;
 USEDMALLOC=false
@@ -98,6 +115,7 @@ then
 EXITAFTERANALYSIS=true
 elif [[ $1 = '-abortreaders' ]]
 then
+ABORTREADERS=true
 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
 JAVAOPTS="$JAVAOPTS -abortreaders"
 elif [[ $1 = '-robustroot' ]]
@@ -107,6 +125,12 @@ shift
 elif [[ $1 = '-nojava' ]]
 then
 NOJAVA=true
+elif [[ $1 = '-garbagestats' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
+elif [[ $1 = '-64bit' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
 elif [[ $1 = '-fastcheck' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
@@ -132,12 +156,27 @@ elif [[ $1 = '-dsm' ]]
 then
 JAVAOPTS="$JAVAOPTS -dsm"
 DSMFLAG=true
+elif [[ $1 = '-fastmemcpy' ]]
+then
+FASTMEMCPY=true
+EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
+elif [[ $1 = '-singleTM' ]]
+then
+JAVAOPTS="$JAVAOPTS -singleTM"
+EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
+SINGLETM=true
+elif [[ $1 = '-stmdebug' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
+elif [[ $1 = '-stmstats' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
 elif [[ $1 = '-prefetch' ]]
 then
 JAVAOPTS="$JAVAOPTS -prefetch"
 elif [[ $1 = '-transstats' ]]
 then
-TRANSSTATSFLAG=true
+EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
 elif [[ $1 = '-printflat' ]]
 then
 JAVAOPTS="$JAVAOPTS -printflat"
@@ -150,11 +189,11 @@ then
 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
 elif [[ $1 = '-profile' ]]
 then
-RAWPROFILEFLAG=true
+PROFILEFLAG=true
 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
-elif [[ $1 = '-rawuseio' ]]
+elif [[ $1 = '-useio' ]]
 then
-RAWUSEIOFLAG=true
+USEIOFLAG=true
 elif [[ $1 = '-taskstate' ]]
 then
 JAVAOPTS="$JAVAOPTS -taskstate"
@@ -176,9 +215,16 @@ elif [[ $1 = '-raw' ]]
 then
 RAWFLAG=true
 JAVAOPTS="$JAVAOPTS -raw"
-elif [[ $1 = '-rawcacheflush' ]]
+elif [[ $1 = '-tilera' ]]
+then
+TILERAFLAG=true
+elif [[ $1 = '-tileraconfig' ]]
+then
+TILERACONFIG="$2"
+shift
+elif [[ $1 = '-cacheflush' ]]
 then
-RAWCACHEFLUSHFLAG=true
+CACHEFLUSHFLAG=true
 elif [[ $1 = '-rawconfig' ]]
 then
 RAWCONFIG="$2"
@@ -189,6 +235,9 @@ INTERRUPTFLAG=true
 elif [[ $1 = '-threadsimulate' ]]
 then
 THREADSIMULATEFLAG=true
+elif [[ $1 = '-abcclose' ]]
+then
+JAVAOPTS="$JAVAOPTS -abcclose"
 elif [[ $1 = '-optional' ]]
 then
 JAVAOPTS="$JAVAOPTS -optional"
@@ -209,6 +258,20 @@ JAVAOPTS="$JAVAOPTS -webinterface"
 elif [[ $1 = '-instructionfailures' ]]
 then
 JAVAOPTS="$JAVAOPTS -instructionfailures"
+elif [[ $1 = '-joptimize' ]]
+then
+JAVAOPTS="$JAVAOPTS -optimize"
+elif [[ $1 = '-dcopts' ]]
+then
+JAVAOPTS="$JAVAOPTS -dcopts"
+elif [[ $1 = '-mlp' ]]
+then
+JAVAOPTS="$JAVAOPTS -mlp"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
+elif [[ $1 = '-mlpdebug' ]]
+then
+JAVAOPTS="$JAVAOPTS -mlpdebug"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
 elif [[ $1 = '-check' ]]
 then
 CHECKFLAG=true
@@ -224,8 +287,8 @@ cd $CURDIR
 shift
 elif [[ $1 = '-debug' ]]
 then
-RAWDEBUGFLAG=true
-EXTRAOPTIONS="$EXTRAOPTIONS -g"
+DEBUGFLAG=true
+EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
 elif [[ $1 = '-rawpath' ]]
 then
 RAWPATHFLAG=true
@@ -249,10 +312,17 @@ then
 JAVAOPTS="$JAVAOPTS -thread"
 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
 THREADFLAG=true
+elif [[ $1 = '-distributioninfo' ]]
+then
+JAVAOPTS="$JAVAOPTS -distributioninfo"
 elif [[ $1 = '-curdir' ]]
 then
 CURDIR=$2
 shift
+elif [[ $1 = '-outputdir' ]]
+then
+JAVAOPTS="$JAVAOPTS -outputdir $2"
+shift
 else
 SRCFILES="$SRCFILES $1"
 fi
@@ -272,13 +342,42 @@ then
 JAVAOPTS="$JAVAOPTS -struct structfile"
 fi
 
+# Setup class path
+
+if $RECOVERFLAG
+then
+if $FASTCHECK
+then
+#fast transactions
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
+else
+#base bristlecone files
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
+fi
+else
+if $DSMFLAG
+then
+#dsm stuff
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
+elif $SINGLETM
+then
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
+elif $THREADFLAG
+then
+#threading java stuff
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
+fi
+#base java stuff
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
+fi
+
 # Build bristlecone/java sources
 
 if $MULTICOREFLAG
 then
 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
-$JAVAOPTS $SRCFILES
+$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
+-dir $BUILDDIR $JAVAOPTS $SRCFILES
 then exit $?
 fi
 else
@@ -286,7 +385,7 @@ else
 if ! $NOJAVA
 then
 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR  \
+$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
 $JAVAOPTS $SRCFILES
 then exit $?
 fi
@@ -339,7 +438,7 @@ fi # CHECKFLAG
 if $RAWFLAG
 then # RAWFLAG
 RAWDIR="$CURDIR/raw"
-MAKEFILE="../Makefile.raw"
+MAKEFILE="Makefile.raw"
 mkdir $RAWDIR
 cd $RAWDIR
 make clean
@@ -347,9 +446,9 @@ rm ./*
 
 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
 
-if $RAWCACHEFLUSHFLAG
+if $CACHEFLUSHFLAG
 then # print path
-RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWCACHEFLUSH"
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
 fi
 
 if $RAWPATHFLAG
@@ -357,19 +456,19 @@ then # print path
 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
 fi
 
-if $RAWDEBUGFLAG
+if $DEBUGFLAG
 then #debug version
-RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
 fi
 
-if $RAWPROFILEFLAG
+if $PROFILEFLAG
 then # profile version
-RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPROFILE"
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
 fi
 
-if $RAWUSEIOFLAG
+if $USEIOFLAG
 then # useio version
-RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWUSEIO"
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
 fi
 
 if $INTERRUPTFLAG
@@ -377,7 +476,7 @@ then #INTERRUPT version
 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
 fi #INTERRUPT version
 
-if $RAWUSEIOFLAG
+if $USEIOFLAG
 then # useio version
 MAKEFILE="$MAKEFILE.io"
 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
@@ -385,17 +484,93 @@ else
 MAKEFILE="$MAKEFILE.$RAWCONFIG"
 fi #useio version
 
-cp $MAKEFILE ./Makefile
+cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
 cp ../Runtime/*.c ./
 cp ../Runtime/*.h ./
 cp ../Runtime/*.S ./
 cp ../Runtime/*.s ./
+cp ../Runtime/RAW/*.c ./
+cp ../Runtime/RAW/*.h ./
+cp ../Runtime/RAW/*.S ./
+cp ../Runtime/RAW/*.s ./
 cp ../tmpbuilddirectory/*.c ./
 cp ../tmpbuilddirectory/*.h ./
 
 make
 
-else #!RAWFLAG
+elif $TILERAFLAG
+then # TILERAFLAG
+TILERADIR="$CURDIR/tilera"
+MAKEFILE="Makefile.tilera.$TILERACONFIG"
+SIMHVC="sim.hvc.$TILERACONFIG"
+PCIHVC="pci.hvc.$TILERACONFIG"
+mkdir $TILERADIR
+cd $TILERADIR
+make clean
+rm ./*
+
+export TILERACFLAGS="-DTASK -DMULTICORE"
+
+if $CACHEFLUSHFLAG
+then # print path
+TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
+fi
+
+if $RAWPATHFLAG
+then # print path
+TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
+fi
+
+if $DEBUGFLAG
+then #debug version
+TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
+fi
+
+if $PROFILEFLAG
+then # profile version
+TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
+fi
+
+if $USEIOFLAG
+then # useio version
+TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
+fi
+
+if $INTERRUPTFLAG
+then #INTERRUPT version
+TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
+fi #INTERRUPT version
+
+cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
+cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
+cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
+cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
+cp ../Runtime/multicoretask.c ./
+cp ../Runtime/multicoreruntime.c ./
+cp ../Runtime/Queue.c ./
+cp ../Runtime/file.c ./
+cp ../Runtime/math.c ./
+cp ../Runtime/object.c ./
+cp ../Runtime/GenericHashtable.c ./
+cp ../Runtime/SimpleHash.c ./
+cp ../Runtime/ObjectHash.c ./
+cp ../Runtime/socket.c ./
+cp ../Runtime/mem.c ./
+cp ../Runtime/GenericHashtable.h ./
+cp ../Runtime/mem.h ./
+cp ../Runtime/multicoreruntime.h ./
+cp ../Runtime/object.h ./
+cp ../Runtime/ObjectHash.h ./
+cp ../Runtime/Queue.h ./
+cp ../Runtime/runtime.h ./
+cp ../Runtime/SimpleHash.h ./
+cp ../Tilera/Runtime/*.c ./
+cp ../Tilera/Runtime/*.h ./
+cp ../Tilera/lib/* ./
+cp ../tmpbuilddirectory/*.c ./
+cp ../tmpbuilddirectory/*.h ./
+
+else #!RAWFLAG && !TILERAFLAG
 cd $CURDIR 
 
 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
@@ -416,14 +591,26 @@ $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
 $ROBUSTROOT/Runtime/math.c \
 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
 
+if $FASTMEMCPY
+then
+FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
+fi
+
 if $DSMFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
-if $TRANSSTATSFLAG
+FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.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"
+fi
+
+if $SINGLETM
 then
-EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
+FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
 fi
-FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.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"
+
+if $ABORTREADERS
+then
+FILES="$FILES $DSMRUNTIME/abortreaders.c"
 fi
 
 if $FASTCHECK
@@ -431,6 +618,13 @@ then
 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
 fi
 
+if $MLP
+then
+FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
+FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
+FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
+fi
+
 if $RECOVERFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"