From b9df1caacff3dbe5959bc12e0e6ba46500fcd3e2 Mon Sep 17 00:00:00 2001 From: adash Date: Tue, 19 Aug 2008 03:21:31 +0000 Subject: [PATCH] changes to build script to increase java heap memory latest changes to Moldyn benchmark decrease size of prefetch insertion queue other small changes --- .../src/Benchmarks/Prefetch/Em3d/dsm/makefile | 8 +- .../Prefetch/Moldyn/dsm/JGFMolDynBench.java | 146 ++++++++++-------- .../Benchmarks/Prefetch/Moldyn/dsm/makefile | 12 +- .../src/Benchmarks/Prefetch/SOR/dsm/makefile | 2 +- Robust/src/Benchmarks/Prefetch/bm.txt | 13 +- Robust/src/Benchmarks/Prefetch/run.sh | 26 ++-- Robust/src/IR/Flat/BuildCode.java | 1 - Robust/src/IR/Tree/SemanticCheck.java | 2 +- .../DSTM/interface/addPrefetchEnhance.c | 3 +- .../Runtime/DSTM/interface/addUdpEnhance.c | 5 +- Robust/src/Runtime/DSTM/interface/dstm.h | 6 +- Robust/src/Runtime/DSTM/interface/gCollect.c | 3 - Robust/src/Runtime/DSTM/interface/queue.c | 3 +- Robust/src/Runtime/DSTM/interface/trans.c | 43 ++++-- Robust/src/buildscript | 2 +- 15 files changed, 157 insertions(+), 118 deletions(-) diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile index 85623321..a1616397 100644 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile @@ -13,10 +13,10 @@ SRC3=${MAINCLASS}2.java \ Node2.java \ EVector.java -FLAGS=-dsm -prefetch -optimize -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -debug -mainclass ${MAINCLASS} -trueprob 0.91 -FLAGS1=-dsm -prefetch -dsmcaching -optimize -excprefetch Node.makeUniqueNeighbors -excprefetch EVector.ensureCapacity -excprefetch EVector.addElement -excprefetch BiGraph.makeFromNodes -excprefetch EVector.elementAt -excprefetch BiGraph.initializeNodes -excprefetch BiGraph.allocateNodes -mainclass ${MAINCLASS} -trueprob 0.91 -FLAGS2=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.91 -FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} +FLAGS=-dsm -prefetch -optimize -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -debug -mainclass ${MAINCLASS} -trueprob 0.85 +FLAGS1=-dsm -prefetch -dsmcaching -optimize -excprefetch Node.makeUniqueNeighbors -excprefetch EVector.ensureCapacity -excprefetch EVector.addElement -excprefetch BiGraph.makeFromNodes -excprefetch EVector.elementAt -excprefetch BiGraph.initializeNodes -excprefetch BiGraph.allocateNodes -mainclass ${MAINCLASS} -trueprob 0.85 +FLAGS2=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.85 +FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} -trueprob 0.85 default: # ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java index 371b2904..24fcb3ed 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java @@ -181,10 +181,11 @@ class mdRunner extends Thread { } public void init(particle[] one, int mdsize) { - for (lg=0; lg<=1; lg++) { - for (i=0; i vaverh) { count = count + 1.0; } vel = vel + velt; @@ -434,7 +455,7 @@ class mdRunner extends Thread { if((move < istop) && (((move+1) % irep) == 0)) { sc = Math.sqrt(tref / (tscale*ekin)); - for (i=0;i> ${LOGDIR}/${NONPREFETCH}_local_${EXTENSION}.txt - sleep 4 - i=`expr $i + 1` - done +#while [ $i -lt $1 ]; do +# /usr/bin/time -f "%e" ./${NONPREFETCH} master $ARGS1 2>> ${LOGDIR}/${NONPREFETCH}_local_${EXTENSION}.txt +# sleep 4 +# i=`expr $i + 1` +# done i=0; while [ $i -lt $1 ]; do /usr/bin/time -f "%e" ./${NONPREFETCH_NONCACHE} master $ARGS1 2>> ${LOGDIR}/${NONPREFETCH_NONCACHE}_local_${EXTENSION}.txt @@ -95,30 +95,30 @@ function callrun { localrun 3 echo "---------- Running single thread remote $BMDIR non-prefetch + non-cache on 2 machines ---------- " - oneremote 3 1 $NONPREFETCH_NONCACHE +# oneremote 1 1 $NONPREFETCH_NONCACHE echo "---------- Running single thread remote $BMDIR non-prefetch on 2 machines ---------- " - oneremote 3 1 $NONPREFETCH +# oneremote 1 1 $NONPREFETCH echo "---------- Running single thread remote $BMDIR prefetch on 2 machines ---------- " - oneremote 3 1 $PREFETCH +# oneremote 1 1 $PREFETCH echo "---------- Running two threads $BMDIR non-prefetch + non-cache on 2 machines ---------- " run 3 2 $NONPREFETCH_NONCACHE2 echo "---------- Running two threads $BMDIR non-prefetch on 2 machines ---------- " - run 3 2 $NONPREFETCH2 +# run 3 2 $NONPREFETCH2 echo "---------- Running two threads $BMDIR prefetch on 2 machines ---------- " run 3 2 $PREFETCH2 echo "---------- Running three threads $BMDIR non-prefetch + non-cache on 3 machines ---------- " run 3 3 $NONPREFETCH_NONCACHE3 echo "---------- Running three threads $BMDIR non-prefetch on 3 machines ---------- " - run 3 3 $NONPREFETCH3 +# run 3 3 $NONPREFETCH3 echo "---------- Running three threads $BMDIR prefetch on 3 machines ---------- " run 3 3 $PREFETCH3 echo "---------- Running four threads $BMDIR non-prefetch + non-cache on 4 machines ---------- " run 3 4 $NONPREFETCH_NONCACHE4 echo "---------- Running four threads $BMDIR non-prefetch on 4 machines ---------- " - run 3 4 $NONPREFETCH4 +# run 3 4 $NONPREFETCH4 echo "---------- Running four threads $BMDIR prefetch on 4 machines ---------- " run 3 4 $PREFETCH4 @@ -142,7 +142,9 @@ function callmicrorun { } benchmarks='array chase mmver200 mmver600' -#benchmarks='em3dver40001303 sorverD' +#benchmarks='em3dver10000100015' +#benchmarks='moldynverA' +#benchmarks='sorverD' //8000 X 8000 matrix echo "---------- Clean old files ---------- " rm runlog/* diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index f5522666..80174069 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -350,7 +350,6 @@ public class BuildCode { MethodDescriptor md=lb.getMethod(); FlatMethod fm=state.getMethodFlat(md); if (!md.getModifiers().isNative()) { - System.out.println("***"+fm); generateFlatMethod(fm, lb, outmethod); } } diff --git a/Robust/src/IR/Tree/SemanticCheck.java b/Robust/src/IR/Tree/SemanticCheck.java index 816ee712..a12084d5 100644 --- a/Robust/src/IR/Tree/SemanticCheck.java +++ b/Robust/src/IR/Tree/SemanticCheck.java @@ -706,7 +706,7 @@ public class SemanticCheck { //we have a type ClassDescriptor cd=typeutil.getClass(min.getBaseName().getSymbol()); if (cd==null) - throw new Error(min.getBaseName()+" undefined"); + throw new Error("md = "+ md.toString()+ " "+min.getBaseName()+" undefined"); typetolookin=new TypeDescriptor(cd); } } else if ((md instanceof MethodDescriptor)&&min.getMethodName().equals("super")) { diff --git a/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c b/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c index 30da7aa2..a368e86f 100644 --- a/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c +++ b/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c @@ -50,8 +50,9 @@ void handleDynPrefetching(int numLocal, int ntuples, int siteid) { } else { if(getOperationMode(siteid) != 0) { evalPrefetch[siteid].uselesscount--; - if(evalPrefetch[siteid].uselesscount <= 0) + if(evalPrefetch[siteid].uselesscount <= 0) { evalPrefetch[siteid].operMode = 0; + } } } } diff --git a/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c b/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c index aa8eeb82..defb77f3 100644 --- a/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c +++ b/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c @@ -90,7 +90,7 @@ void *udpListenBroadcast(void *sockfd) { short status = *((short *) &readBuffer[0]); switch (status) { case INVALIDATE_OBJS: - if((retval = invalidateFromPrefetchCache(readBuffer))!= 0) { + if((retval = invalidateFromPrefetchCache(readBuffer))!= 0) { printf("Error: In invalidateFromPrefetchCache() at %s, %d\n", __FILE__, __LINE__); break; } @@ -194,13 +194,14 @@ int invalidateFromPrefetchCache(char *buffer) { if(mid != myIpAddr) { /* Read objects sent */ int numObjsRecv = *((short *)(buffer+offset)) / sizeof(unsigned int); + offset += sizeof(short); int i; for(i = 0; i < numObjsRecv; i++) { unsigned int oid; oid = *((unsigned int *)(buffer+offset)); objheader_t *header; /* Lookup Objects in prefetch cache and remove them */ - if((header = prehashSearch(oid)) != NULL) { + if(((header = prehashSearch(oid)) != NULL)) { prehashRemove(oid); } offset += sizeof(unsigned int); diff --git a/Robust/src/Runtime/DSTM/interface/dstm.h b/Robust/src/Runtime/DSTM/interface/dstm.h index df979d74..2a347784 100644 --- a/Robust/src/Runtime/DSTM/interface/dstm.h +++ b/Robust/src/Runtime/DSTM/interface/dstm.h @@ -55,8 +55,8 @@ #define LISTEN_PORT 2156 #define UDP_PORT 2158 //Prefetch tuning paramters -#define RETRYINTERVAL 7 //N -#define SHUTDOWNINTERVAL 4 //M +#define RETRYINTERVAL 20//N +#define SHUTDOWNINTERVAL 3 //M #include #include @@ -213,7 +213,7 @@ typedef struct thread_data_array { int *count; /* Variable to count responses from all participants to the TRANS_REQUEST protocol */ char *replyctrl; /* Shared ctrl message that stores the reply to be sent to participants, filled by decideResponse() */ char *replyretry; /* Shared variable that keep track if coordinator needs retry */ - transrecord_t *rec; /* To send modified objects */ + transrecord_t *rec; /* Shared variable transaction record send to all thread data */ } thread_data_array_t; diff --git a/Robust/src/Runtime/DSTM/interface/gCollect.c b/Robust/src/Runtime/DSTM/interface/gCollect.c index 9e5e08c6..1dd09c25 100644 --- a/Robust/src/Runtime/DSTM/interface/gCollect.c +++ b/Robust/src/Runtime/DSTM/interface/gCollect.c @@ -140,9 +140,6 @@ void clearPLookUpTable(void *begin, void *end) { objheader_t *objheader; if((objheader = prehashSearch(oid)) != NULL) { prehashRemove(oid); -#ifdef CHECKTA - printf("%s() clearing Look up table for oid = %x\n", __func__, oid); -#endif } } } diff --git a/Robust/src/Runtime/DSTM/interface/queue.c b/Robust/src/Runtime/DSTM/interface/queue.c index 507cf658..2fb7e990 100644 --- a/Robust/src/Runtime/DSTM/interface/queue.c +++ b/Robust/src/Runtime/DSTM/interface/queue.c @@ -6,8 +6,7 @@ pthread_mutex_t qlock; pthread_mutexattr_t qlockattr; pthread_cond_t qcond; - -#define QSIZE 1000000 //1 MB +#define QSIZE 2048 //2 KB void queueInit(void) { /* Intitialize primary queue */ diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index 9003e8ab..2334eca1 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -21,6 +21,7 @@ /* Global Variables */ extern int classsize[]; pfcstats_t *evalPrefetch; +extern int numprefetchsites; //Global variable containing number of prefetch sites extern pthread_mutex_t mainobjstore_mutex;// Mutex to lock main Object store objstr_t *prefetchcache; //Global Prefetch cache pthread_mutex_t prefetchcache_mutex;// Mutex to lock Prefetch Cache @@ -68,7 +69,7 @@ void send_data(int fd , void *buf, int buflen) { numbytes = send(fd, buffer, size, MSG_NOSIGNAL); if (numbytes == -1) { perror("send"); - return; + exit(0); } buffer += numbytes; size -= numbytes; @@ -83,7 +84,7 @@ void recv_data(int fd , void *buf, int buflen) { numbytes = recv(fd, buffer, size, 0); if (numbytes == -1) { perror("recv"); - return; + exit(0); } buffer += numbytes; size -= numbytes; @@ -861,6 +862,14 @@ void decideResponse(thread_data_array_t *tdata) { /* Send Commit */ *(tdata->replyctrl) = TRANS_COMMIT; *(tdata->replyretry) = 0; +#ifdef CACHE +#if 0 + /* Turn prefetching on */ + int i; + for (i=0; ireplyctrl) = TRANS_ABORT; @@ -1795,29 +1804,29 @@ void transAbort(transrecord_t *trans) { plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mid, int num_objs) { plistnode_t *ptr, *tmp; int found = 0, offset = 0; - + tmp = pile; //Add oid into a machine that is already present in the pile linked list structure while(tmp != NULL) { if (tmp->mid == mid) { int tmpsize; - + if (STATUS(headeraddr) & NEW) { - tmp->oidcreated[tmp->numcreated] = OID(headeraddr); - tmp->numcreated++; - GETSIZE(tmpsize, headeraddr); - tmp->sum_bytes += sizeof(objheader_t) + tmpsize; + tmp->oidcreated[tmp->numcreated] = OID(headeraddr); + tmp->numcreated++; + GETSIZE(tmpsize, headeraddr); + tmp->sum_bytes += sizeof(objheader_t) + tmpsize; }else if (STATUS(headeraddr) & DIRTY) { - tmp->oidmod[tmp->nummod] = OID(headeraddr); - tmp->nummod++; - GETSIZE(tmpsize, headeraddr); - tmp->sum_bytes += sizeof(objheader_t) + tmpsize; + tmp->oidmod[tmp->nummod] = OID(headeraddr); + tmp->nummod++; + GETSIZE(tmpsize, headeraddr); + tmp->sum_bytes += sizeof(objheader_t) + tmpsize; } else { - offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; - *((unsigned int *)(((char *)tmp->objread) + offset))=OID(headeraddr); - offset += sizeof(unsigned int); - *((short *)(((char *)tmp->objread) + offset)) = headeraddr->version; - tmp->numread ++; + offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; + *((unsigned int *)(((char *)tmp->objread) + offset))=OID(headeraddr); + offset += sizeof(unsigned int); + *((short *)(((char *)tmp->objread) + offset)) = headeraddr->version; + tmp->numread ++; } found = 1; break; diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 3ba69925..5947414d 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -247,7 +247,7 @@ else #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ if ! $NOJAVA then -if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ +if ! java -Xms50m -Xmx200m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \ $JAVAOPTS $SRCFILES then exit $? -- 2.34.1