From 9aaf85865ba713d638595470a3351ee19560b279 Mon Sep 17 00:00:00 2001 From: jzhou Date: Fri, 24 Apr 2009 00:05:40 +0000 Subject: [PATCH] add Tilera version stuff in buildscript and removes some redundant codes to avoid compilation warnings --- Robust/src/IR/State.java | 1 - Robust/src/Main/Main.java | 3 - Robust/src/Runtime/GenericHashtable.c | 2 +- Robust/src/Runtime/ObjectHash.c | 1 - Robust/src/Runtime/RAW/runtime_arch.h | 3 + Robust/src/Runtime/RAW/task_arch.c | 36 ++++++------ Robust/src/Runtime/SimpleHash.c | 2 - Robust/src/Runtime/mem.c | 8 +-- Robust/src/Runtime/multicoreruntime.c | 29 +++++----- Robust/src/Runtime/multicoreruntime.h | 4 +- Robust/src/Runtime/multicoretask.c | 38 +++++++------ Robust/src/Runtime/object.c | 8 +-- Robust/src/Runtime/runtime.h | 5 +- Robust/src/Runtime/socket.c | 44 +++++++------- Robust/src/buildscript | 82 +++++++++++++++++++++++++-- 15 files changed, 169 insertions(+), 97 deletions(-) diff --git a/Robust/src/IR/State.java b/Robust/src/IR/State.java index 011a1756..aec08257 100644 --- a/Robust/src/IR/State.java +++ b/Robust/src/IR/State.java @@ -66,7 +66,6 @@ public class State { public String OWNERSHIPALIASFILE=null; public boolean OPTIONAL=false; public boolean ARRAYBOUNDARYCHECK=true; - public boolean RAW=false; public boolean SCHEDULING=false; public boolean USEPROFILE=false; public boolean THREAD=false; diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 743d309c..d70417c9 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -135,8 +135,6 @@ public class Main { state.OPTIMIZE=true; else if (option.equals("-dcopts")) state.DCOPTS=true; - else if (option.equals("-raw")) - state.RAW=true; else if (option.equals("-scheduling")) state.SCHEDULING=true; else if (option.equals("-distributioninfo")) @@ -196,7 +194,6 @@ public class Main { System.out.println("-mlp build mlp code, report progress and interim results"); System.out.println("-multicore generate multi-core version binary"); System.out.println("-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"); - System.out.println("-raw generate raw version binary (should be used together with -multicore)"); System.out.println("-interrupt generate raw version binary with interruption (should be used togethere with -raw)"); System.out.println("-rawconfig config raw simulator as 4xn (should be used together with -raw)"); System.out.println("-rawpath print out execute path information for raw version (should be used together with -raw)"); diff --git a/Robust/src/Runtime/GenericHashtable.c b/Robust/src/Runtime/GenericHashtable.c index a3f838ca..83a65b63 100755 --- a/Robust/src/Runtime/GenericHashtable.c +++ b/Robust/src/Runtime/GenericHashtable.c @@ -115,7 +115,7 @@ int hashsize(struct genhashtable *ht) { void genrehash(struct genhashtable * ht) { struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC(sizeof (struct genpointerlist *)*ht->currentsize); struct genpointerlist **oldbins=ht->bins; - long j,i; + long i; for(i=0; icurrentsize; i++) { struct genpointerlist * tmpptr=oldbins[i]; diff --git a/Robust/src/Runtime/ObjectHash.c b/Robust/src/Runtime/ObjectHash.c index 77a9233b..8312857d 100755 --- a/Robust/src/Runtime/ObjectHash.c +++ b/Robust/src/Runtime/ObjectHash.c @@ -66,7 +66,6 @@ int ObjectHashremove(struct ObjectHash *thisvar, int key) { unsigned int hashkey = (unsigned int)key % thisvar->size; struct ObjectNode **ptr = &thisvar->bucket[hashkey]; - int i; while (*ptr) { if ((*ptr)->key == key) { diff --git a/Robust/src/Runtime/RAW/runtime_arch.h b/Robust/src/Runtime/RAW/runtime_arch.h index e4d75541..6e33e5cf 100644 --- a/Robust/src/Runtime/RAW/runtime_arch.h +++ b/Robust/src/Runtime/RAW/runtime_arch.h @@ -10,6 +10,9 @@ #include #include +#define BAMBOO_CACHE_LINE_SIZE (kCacheLineSize) +#define BAMBOO_CACHE_LINE_MASK (kCacheLineMask) + #define BAMBOO_TOTALCORE (raw_get_num_tiles()) // the total # of cores available in the processor #define BAMBOO_NUM_OF_CORE corenum // the # of current residing core #define BAMBOO_GET_NUM_OF_CORE() (raw_get_abs_pos_x() + raw_get_array_size_x() * raw_get_abs_pos_y()) // compute the # of current residing core diff --git a/Robust/src/Runtime/RAW/task_arch.c b/Robust/src/Runtime/RAW/task_arch.c index f7408602..52c00c1c 100644 --- a/Robust/src/Runtime/RAW/task_arch.c +++ b/Robust/src/Runtime/RAW/task_arch.c @@ -3,10 +3,10 @@ #include "multicoreruntime.h" #include "runtime_arch.h" -inline void initialization() { +__attribute__((always_inline)) inline void initialization() { } // initialization() -inline void initCommunication() { +__attribute__((always_inline)) inline void initCommunication() { #ifdef INTERRUPT if (corenum < NUMCORES) { // set up interrupts @@ -16,7 +16,7 @@ inline void initCommunication() { #endif } -inline void fakeExecution() { +__attribute__((always_inline)) inline void fakeExecution() { // handle communications while(true) { receiveObject(); @@ -31,7 +31,7 @@ void begin() { run(NULL); } -inline void terminate() { +__attribute__((always_inline)) inline void terminate() { raw_test_done(1); } @@ -42,7 +42,7 @@ inline void terminate() { // transfer an object to targetcore // format: object -void transferObject(struct transObjInfo * transObj) { +inline void transferObject(struct transObjInfo * transObj) {// __attribute__((always_inline)){ void * obj = transObj->objptr; int type=((int *)obj)[0]; int targetcore = transObj->targetcore; @@ -138,7 +138,7 @@ void transferObject(struct transObjInfo * transObj) { } } -inline void send_msg_1 (int targetcore, int n0) { +__attribute__((always_inline)) inline void send_msg_1 (int targetcore, int n0) { // send this msg unsigned msgHdr; int self_y, self_x, target_y, target_x; @@ -206,7 +206,7 @@ inline void send_msg_1 (int targetcore, int n0) { } } -inline void send_msg_2 (int targetcore, int n0, int n1) { +__attribute__((always_inline)) inline void send_msg_2 (int targetcore, int n0, int n1) { // send this msg unsigned msgHdr; int self_y, self_x, target_y, target_x; @@ -278,7 +278,7 @@ inline void send_msg_2 (int targetcore, int n0, int n1) { } } -inline void send_msg_3 (int targetcore, int n0, int n1, int n2) { +__attribute__((always_inline)) inline void send_msg_3 (int targetcore, int n0, int n1, int n2) { // send this msg unsigned msgHdr; int self_y, self_x, target_y, target_x; @@ -354,7 +354,7 @@ inline void send_msg_3 (int targetcore, int n0, int n1, int n2) { } } -inline void send_msg_4 (int targetcore, int n0, int n1, int n2, int n3) { +__attribute__((always_inline)) inline void send_msg_4 (int targetcore, int n0, int n1, int n2, int n3) { // send this msg unsigned msgHdr; int self_y, self_x, target_y, target_x; @@ -434,7 +434,7 @@ inline void send_msg_4 (int targetcore, int n0, int n1, int n2, int n3) { } } -inline void send_msg_5 (int targetcore, int n0, int n1, int n2, int n3, int n4) { +__attribute__((always_inline)) inline void send_msg_5 (int targetcore, int n0, int n1, int n2, int n3, int n4) { // send this msg unsigned msgHdr; int self_y, self_x, target_y, target_x; @@ -518,7 +518,7 @@ inline void send_msg_5 (int targetcore, int n0, int n1, int n2, int n3, int n4) } } -inline void send_msg_6 (int targetcore, int n0, int n1, int n2, int n3, int n4, int n5) { +__attribute__((always_inline)) inline void send_msg_6 (int targetcore, int n0, int n1, int n2, int n3, int n4, int n5) { // send this msg unsigned msgHdr; int self_y, self_x, target_y, target_x; @@ -606,7 +606,7 @@ inline void send_msg_6 (int targetcore, int n0, int n1, int n2, int n3, int n4, } } -inline void cache_msg_2 (int targetcore, int n0, int n1) { +__attribute__((always_inline)) inline void cache_msg_2 (int targetcore, int n0, int n1) { // cache this msg #ifdef DEBUG BAMBOO_DEBUGPRINT(0xdede); @@ -620,7 +620,7 @@ inline void cache_msg_2 (int targetcore, int n0, int n1) { outmsgdata[outmsglast++] = n1; } -inline void cache_msg_3 (int targetcore, int n0, int n1, int n2) { +__attribute__((always_inline)) inline void cache_msg_3 (int targetcore, int n0, int n1, int n2) { // cache this msg #ifdef DEBUG BAMBOO_DEBUGPRINT(0xdede); @@ -635,7 +635,7 @@ inline void cache_msg_3 (int targetcore, int n0, int n1, int n2) { outmsgdata[outmsglast++] = n2; } -inline void cache_msg_4 (int targetcore, int n0, int n1, int n2, int n3) { +__attribute__((always_inline)) inline void cache_msg_4 (int targetcore, int n0, int n1, int n2, int n3) { // cache this msg #ifdef DEBUG BAMBOO_DEBUGPRINT(0xdede); @@ -651,7 +651,7 @@ inline void cache_msg_4 (int targetcore, int n0, int n1, int n2, int n3) { outmsgdata[outmsglast++] = n3; } -inline void cache_msg_6 (int targetcore, int n0, int n1, int n2, int n3, int n4, int n5) { +__attribute__((always_inline)) inline void cache_msg_6 (int targetcore, int n0, int n1, int n2, int n3, int n4, int n5) { // cache this msg #ifdef DEBUG BAMBOO_DEBUGPRINT(0xdede); @@ -669,7 +669,7 @@ inline void cache_msg_6 (int targetcore, int n0, int n1, int n2, int n3, int n4, outmsgdata[outmsglast++] = n5; } -inline int receiveMsg() { +__attribute__((always_inline)) inline int receiveMsg() { if(gdn_input_avail() == 0) { #ifdef DEBUG if(corenum < NUMCORES) { @@ -724,7 +724,7 @@ inline int receiveMsg() { } #ifdef PROFILE -inline void profileTaskStart(char * taskname) { +__attribute__((always_inline)) inline void profileTaskStart(char * taskname) { if(!taskInfoOverflow) { TaskInfo* taskInfo = RUNMALLOC(sizeof(struct task_info)); taskInfoArray[taskInfoIndex] = taskInfo; @@ -736,7 +736,7 @@ inline void profileTaskStart(char * taskname) { } } -inline void profileTaskEnd() { +__attribute__((always_inline)) inline void profileTaskEnd() { if(!taskInfoOverflow) { taskInfoArray[taskInfoIndex]->endTime = raw_get_cycle(); taskInfoIndex++; diff --git a/Robust/src/Runtime/SimpleHash.c b/Robust/src/Runtime/SimpleHash.c index b877a7ad..5f872e06 100755 --- a/Robust/src/Runtime/SimpleHash.c +++ b/Robust/src/Runtime/SimpleHash.c @@ -66,7 +66,6 @@ int RuntimeHashremovekey(struct RuntimeHash *thisvar, int key) { unsigned int hashkey = (unsigned int)key % thisvar->size; struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; - int i; while (*ptr) { if ((*ptr)->key == key) { @@ -98,7 +97,6 @@ int RuntimeHashremove(struct RuntimeHash *thisvar, int key, int data) { unsigned int hashkey = (unsigned int)key % thisvar->size; struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; - int i; while (*ptr) { if ((*ptr)->key == key && (*ptr)->data == data) { diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c index c134e507..5ef956b0 100644 --- a/Robust/src/Runtime/mem.c +++ b/Robust/src/Runtime/mem.c @@ -15,18 +15,18 @@ void * mycalloc(int m, int size) { void * p = NULL; - int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask); + int isize = 2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK); BAMBOO_START_CRITICAL_SECTION_MEM(); p = BAMBOO_SHARE_MEM_CALLOC(m, isize); // calloc(m, isize); BAMBOO_CLOSE_CRITICAL_SECTION_MEM(); - return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask)); + return (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK)); } void * mycalloc_i(int m, int size) { void * p = NULL; - int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask); + int isize = 2*BAMBOO_CACHE_LINE_SIZE-4+(size-1)&(~BAMBOO_CACHE_LINE_MASK); p = BAMBOO_SHARE_MEM_CALLOC(m, isize); // calloc(m, isize); - return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask)); + return (void *)(BAMBOO_CACHE_LINE_SIZE+((int)p-1)&(~BAMBOO_CACHE_LINE_MASK)); } void myfree(void * ptr) { diff --git a/Robust/src/Runtime/multicoreruntime.c b/Robust/src/Runtime/multicoreruntime.c index 498a3ec0..5f25575f 100644 --- a/Robust/src/Runtime/multicoreruntime.c +++ b/Robust/src/Runtime/multicoreruntime.c @@ -8,6 +8,9 @@ #ifndef RAW #include #endif +#ifdef MULTICORE +#include "runtime_arch.h" +#endif //#include "option.h" extern int classsize[]; @@ -28,7 +31,7 @@ int instaccum=0; #include "dmalloc.h" #endif -#ifdef RAW +#ifdef MULTICORE void initializeexithandler() { } #else @@ -51,8 +54,8 @@ void initializeexithandler() { /* This function inject failures */ void injectinstructionfailure() { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return; #else #ifdef TASK @@ -87,31 +90,31 @@ void injectinstructionfailure() { } void CALL11(___System______exit____I,int ___status___, int ___status___) { +#ifdef MULTICORE + BAMBOO_EXIT(___status___); +#else #ifdef DEBUG printf("exit in CALL11\n"); #endif -#ifdef RAW - raw_test_done(___status___); -#else exit(___status___); #endif } void CALL11(___System______printI____I,int ___status___, int ___status___) { +#ifdef MULTICORE + BAMBOO_DEBUGPRINT(0x1111); + BAMBOO_DEBUGPRINT_REG(___status___); +#else #ifdef DEBUG printf("printI in CALL11\n"); #endif -#ifdef RAW - raw_test_pass(0x1111); - raw_test_pass_reg(___status___); -#else printf("%d\n", ___status___); #endif } long CALL00(___System______currentTimeMillis____) { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return -1; #else struct timeval tv; long long retval; @@ -124,7 +127,7 @@ long CALL00(___System______currentTimeMillis____) { } void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) { -#ifdef RAW +#ifdef MULTICORE #else struct ArrayObject * chararray=VAR(___s___)->___value___; int i; diff --git a/Robust/src/Runtime/multicoreruntime.h b/Robust/src/Runtime/multicoreruntime.h index e76254a0..164a1b8d 100644 --- a/Robust/src/Runtime/multicoreruntime.h +++ b/Robust/src/Runtime/multicoreruntime.h @@ -106,7 +106,7 @@ inline void cache_msg_3(int targetcore, int n0, int n1, int n2) __attribute__((a inline void cache_msg_4(int targetcore, int n0, int n1, int n2, int n3) __attribute__((always_inline)); inline void cache_msg_6(int targetcore, int n0, int n1, int n2, int n3, int n4, int n5) __attribute__((always_inline)); inline void transferObject(struct transObjInfo * transObj); -inline int receiveMsg(void) __attribute__((always_inline)) __attribute__((always_inline)); +inline int receiveMsg(void) __attribute__((always_inline)); #ifdef PROFILE inline void profileTaskStart(char * taskname) __attribute__((always_inline)); @@ -142,6 +142,8 @@ inline void profileTaskEnd(void) __attribute__((always_inline)); // BAMBOO_CLOSE_CRITICAL_SECTION(): locks for all global data structures // // BAMBOO_WAITING_FOR_LOCK(): routine executed while waiting for lock request // // response // +// BAMBOO_CACHE_LINE_SIZE: the cache line size // +// BAMBOO_CACHE_LINE_MASK: mask for a cache line // // BAMBOO_CACHE_FLUSH_RANGE(x, y): flush cache lines started at x with length y // // BAMBOO_CACHE_FLUSH_ALL(): flush the whole cache of a core if necessary // // BAMBOO_EXIT(x): exit routine // diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index 3dd7dc42..4becf4ef 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -2,6 +2,7 @@ #include "runtime.h" #include "multicoreruntime.h" #include "runtime_arch.h" +#include "GenericHashtable.h" /* extern int injectfailures; extern float failurechance; @@ -36,7 +37,6 @@ void releasereadlock(void* ptr); bool getwritelock(void* ptr); void releasewritelock(void* ptr); void releasewritelock_r(void * lock, void * redirectlock); -inline void run(void * arg); // specific functions used inside critical sections void enqueueObject_I(void * ptr, struct parameterwrapper ** queues, int length); @@ -367,7 +367,7 @@ inline void run(void * arg) { totalexetime = BAMBOO_GET_EXE_TIME(); #else BAMBOO_DEBUGPRINT(0xbbbbbbbb); - BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME()); + BAMBOO_DEBUGPRINT((int)BAMBOO_GET_EXE_TIME()); #endif // profile mode, send msgs to other cores to request pouring // out progiling data @@ -822,7 +822,7 @@ void enqueueObject(void * vptr, struct parameterwrapper ** vqueues, int vlength) struct ___Object___ *ptr = (struct ___Object___ *)vptr; { - struct QueueItem *tmpptr; + //struct QueueItem *tmpptr; struct parameterwrapper * parameter=NULL; int j; int i; @@ -848,7 +848,7 @@ void enqueueObject(void * vptr, struct parameterwrapper ** vqueues, int vlength) if (tagptr==NULL) goto nextloop; //that means the object has no tag but that param needs tag else if(tagptr->type==TAGTYPE) { //one tag - struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; + //struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; for(i=0; inumbertags; i++) { //slotid is parameter->tagarray[2*i]; int tagid=parameter->tagarray[2*i+1]; @@ -892,7 +892,7 @@ void enqueueObject_I(void * vptr, struct parameterwrapper ** vqueues, int vlengt struct ___Object___ *ptr = (struct ___Object___ *)vptr; { - struct QueueItem *tmpptr; + //struct QueueItem *tmpptr; struct parameterwrapper * parameter=NULL; int j; int i; @@ -918,7 +918,7 @@ void enqueueObject_I(void * vptr, struct parameterwrapper ** vqueues, int vlengt if (tagptr==NULL) goto nextloop; //that means the object has no tag but that param needs tag else if(tagptr->type==TAGTYPE) { //one tag - struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; + //struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; for(i=0; inumbertags; i++) { //slotid is parameter->tagarray[2*i]; int tagid=parameter->tagarray[2*i+1]; @@ -1269,7 +1269,7 @@ int processlockrequest(int locktype, int lock, int obj, int requestcore, int roo // otherwise -- received msg type int receiveObject() { int deny = 0; - int targetcore = 0; + //int targetcore = 0; msg: if(receiveMsg() == -1) { @@ -1906,7 +1906,7 @@ bool getwritelock(void * ptr) { int targetcore = 0; // for 32 bit machine, the size is always 5 words - int msgsize = 5; + //int msgsize = 5; lockobj = (int)ptr; if(((struct ___Object___ *)ptr)->lock == NULL) { @@ -2261,11 +2261,11 @@ void releasewritelock_I_r(void * lock, void * redirectlock) { int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags) { void * taskpointerarray[MAXTASKPARAMS]; int j; - int numparams=parameter->task->numParameters; + //int numparams=parameter->task->numParameters; int numiterators=parameter->task->numTotal-1; int retval=1; - int addnormal=1; - int adderror=1; + //int addnormal=1; + //int adderror=1; struct taskdescriptor * task=parameter->task; @@ -2298,7 +2298,7 @@ backtrackinit: while(1) { /* Enqueue current state */ - int launch = 0; + //int launch = 0; struct taskparamdescriptor *tpd=RUNMALLOC(sizeof(struct taskparamdescriptor)); tpd->task=task; tpd->numParameters=numiterators+1; @@ -2340,11 +2340,11 @@ backtrackinc: int enqueuetasks_I(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags) { void * taskpointerarray[MAXTASKPARAMS]; int j; - int numparams=parameter->task->numParameters; + //int numparams=parameter->task->numParameters; int numiterators=parameter->task->numTotal-1; int retval=1; - int addnormal=1; - int adderror=1; + //int addnormal=1; + //int adderror=1; struct taskdescriptor * task=parameter->task; @@ -2377,7 +2377,7 @@ backtrackinit: while(1) { /* Enqueue current state */ - int launch = 0; + //int launch = 0; struct taskparamdescriptor *tpd=RUNMALLOC_I(sizeof(struct taskparamdescriptor)); tpd->task=task; tpd->numParameters=numiterators+1; @@ -2457,6 +2457,8 @@ void removereadfd(int fd) { #define OFFSET 0 #endif +int containstag(struct ___Object___ *ptr, struct ___TagDescriptor___ *tag); + void executetasks() { void * taskpointerarray[MAXTASKPARAMS+OFFSET]; int numparams=0; @@ -2780,7 +2782,7 @@ parameterpresent: #endif #endif // #if 0: for recovery if (x=setjmp(error_handler)) { - int counter; + //int counter; /* Recover */ #ifdef DEBUG #ifndef RAW @@ -2930,7 +2932,7 @@ void processobject(struct parameterwrapper *parameter, int index, struct paramet for(i=0; inumbertags; i++) { int slotid=pd->tagarray[2*i]; - int tagid=pd->tagarray[2*i+1]; + //int tagid=pd->tagarray[2*i+1]; if (statusarray[slotid+numparams]!=0) { /* This tag has already been enqueued, use it to narrow search */ parameter->iterators[*iteratorcount].tagbindings[tagcount]=slotid+numparams; diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c index 766d2a64..a935927d 100644 --- a/Robust/src/Runtime/object.c +++ b/Robust/src/Runtime/object.c @@ -1,6 +1,6 @@ #include "object.h" -#ifdef RAW -#include +#ifdef MULTICORE +#include "runtime_arch.h" #else #include "stdio.h" #endif @@ -74,8 +74,8 @@ int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) { pthread_cond_broadcast(&objcond); pthread_mutex_unlock(&objlock); } else { -#ifdef RAW - raw_test_done(-1); +#ifdef MULTICORE + BAMBOO_EXIT(-1); #else printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n"); exit(-1); diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index 3b4dd34c..7480746b 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -92,8 +92,8 @@ void createstartupobject(); #ifdef TASK #include "SimpleHash.h" -#include "chash.h" #ifndef MULTICORE +#include "chash.h" #include "ObjectHash.h" #include "structdefs.h" #endif @@ -127,7 +127,8 @@ extern struct ___Object___ * ___fcrevert___; #endif #ifdef MULTICORE -inline int receiveObject(void); +inline void run(void * arg); +int receiveObject(void); void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length); void flagorandinit(void * ptr, int ormask, int andmask); void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length); diff --git a/Robust/src/Runtime/socket.c b/Robust/src/Runtime/socket.c index 12f5d439..564e7428 100644 --- a/Robust/src/Runtime/socket.c +++ b/Robust/src/Runtime/socket.c @@ -1,7 +1,7 @@ #include "runtime.h" #include "structdefs.h" #include -#ifndef RAW +#ifndef MULTICORE #include #include #include @@ -15,8 +15,8 @@ struct RuntimeHash *fdtoobject; int CALL24(___Socket______nativeConnect____I__AR_B_I, int ___fd___, int ___port___, struct ___Socket___ * ___this___, int ___fd___, struct ArrayObject * ___address___,int ___port___) { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return -1; #else struct sockaddr_in sin; @@ -64,17 +64,21 @@ error: #ifdef TASK int CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ * ___this___, int ___fd___) { +#ifdef MULTICORE +#else if (RuntimeHashcontainskey(fdtoobject, ___fd___)) RuntimeHashremovekey(fdtoobject, ___fd___); RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___)); addreadfd(___fd___); +#endif + return 0; } #endif int CALL12(___Socket______nativeBind_____AR_B_I, int ___port___, struct ArrayObject * ___address___, int ___port___) { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return -1; #else int fd; @@ -131,8 +135,8 @@ error: } struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ArrayObject * ___hostname___) { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return NULL; #else //struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ___ArrayObject___ * ___hostname___) { @@ -180,8 +184,8 @@ struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct A int CALL12(___ServerSocket______createSocket____I, int port, struct ___ServerSocket___ * ___this___, int port) { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return -1; #else int fd; @@ -285,8 +289,8 @@ int CALL12(___ServerSocket______createSocket____I, int port, struct ___ServerSoc } int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSocket___ * ___this___, struct ___Socket___ * ___s___) { -#ifdef RAW - // not supported in RAW version +#ifdef MULTICORE + // not supported in MULTICORE version return -1; #else struct sockaddr_in sin; @@ -328,8 +332,6 @@ int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSo #ifdef MULTICORE flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); enqueueObject(VAR(___this___), NULL, 0); - //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); - //enqueueObject(VAR(___this___), objq4socketobj[corenum], numqueues4socketobj[corenum]); #else flagorand(VAR(___this___),0,0xFFFFFFFE); enqueueObject(VAR(___this___)); @@ -354,7 +356,7 @@ void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, str } if (length!=0) { -#ifndef RAW +#ifndef MULTICORE perror("ERROR IN NATIVEWRITE"); printf("error=%d remaining bytes %d\n",errno, length); #endif @@ -395,7 +397,7 @@ int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___, if (byteread<0) { -#ifndef RAW +#ifndef MULTICORE printf("ERROR IN NATIVEREAD\n"); perror(""); #endif @@ -404,8 +406,6 @@ int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___, #ifdef MULTICORE flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); enqueueObject(VAR(___this___), NULL, 0); - //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); - //enqueueObject(VAR(___this___),objq4socketobj[corenum],numqueues4socketobj[corenum]); #else flagorand(VAR(___this___),0,0xFFFFFFFE); enqueueObject(VAR(___this___)); @@ -415,21 +415,17 @@ int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___, } void CALL01(___Socket______nativeClose____, struct ___Socket___ * ___this___) { +#ifdef MULTICORE +#else int fd=VAR(___this___)->___fd___; int data; #ifdef TASK RuntimeHashget(fdtoobject, fd, &data); RuntimeHashremove(fdtoobject, fd, data); removereadfd(fd); -#ifdef MULTICORE - flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); - enqueueObject(VAR(___this___), NULL, 0); - //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); - //enqueueObject(VAR(___this___),objq4socketobj[corenum],numqueues4socketobj[corenum]); -#else flagorand(VAR(___this___),0,0xFFFFFFFE); enqueueObject(VAR(___this___)); -#endif #endif close(fd); +#endif } diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 3fb9e3ca..8242ff84 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -25,16 +25,17 @@ 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 "-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 "-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 @@ -71,6 +72,7 @@ MLPFLAG=false MLPDEBUG=false MULTICOREFLAG=false RAWFLAG=false +TILERAFLAG=false CACHEFLUSHFLAG=false RAWCONFIG='' DEBUGFLAG=false @@ -200,7 +202,9 @@ shift elif [[ $1 = '-raw' ]] then RAWFLAG=true -JAVAOPTS="$JAVAOPTS -raw" +elif [[ $1 = '-tilera' ]] +then +TILERAFLAG=true elif [[ $1 = '-cacheflush' ]] then CACHEFLUSHFLAG=true @@ -475,7 +479,75 @@ cp ../tmpbuilddirectory/*.h ./ make -else #!RAWFLAG +elif $TILERAFLAG +then # TILERAFLAG +TILERADIR="$CURDIR/tilera" +MAKEFILE="Makefile.tilera" +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/Runtime/Tilera/$MAKEFILE ./Makefile +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/taskdefs.c ./ +cp ../Runtime/methods.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 ../Runtime/Tilera/*.c ./ +cp ../Runtime/Tilera/*.h ./ +cp ../tmpbuilddirectory/*.c ./ +cp ../tmpbuilddirectory/*.h ./ + +else #!RAWFLAG && !TILERAFLAG cd $CURDIR INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \ -- 2.34.1