# HG changeset patch # User Nina Engelhardt # Date 1348582360 -7200 # Node ID a7ca8f45c1c4b551f8966e81982d48fc5b2ac08e # Parent 58a71af04cd1515806e636189bd475b72761e85d fix coding standard to work with -std=gnu99 -Wall diff -r 58a71af04cd1 -r a7ca8f45c1c4 Measurement/dependency.c --- a/Measurement/dependency.c Mon Sep 17 11:07:07 2012 +0200 +++ b/Measurement/dependency.c Tue Sep 25 16:12:40 2012 +0200 @@ -20,7 +20,7 @@ return newn; } -int set_dependency_file(FILE* file){ +void set_dependency_file(FILE* file){ dependency_file = file; } @@ -93,4 +93,4 @@ forAllInListOfArraysDo(nton->senders,&print_nton_set_helper); forAllInListOfArraysDo(nton->receivers,&print_nton_set_helper); fprintf(dependency_file,"\n"); -} \ No newline at end of file +} diff -r 58a71af04cd1 -r a7ca8f45c1c4 Measurement/dependency.h --- a/Measurement/dependency.h Mon Sep 17 11:07:07 2012 +0200 +++ b/Measurement/dependency.h Tue Sep 25 16:12:40 2012 +0200 @@ -36,7 +36,7 @@ NtoN* new_NtoN(int id); -int set_dependency_file(FILE* file); +void set_dependency_file(FILE* file); void print_ctl_dependency_to_file(void* _dep); diff -r 58a71af04cd1 -r a7ca8f45c1c4 VSs.c --- a/VSs.c Mon Sep 17 11:07:07 2012 +0200 +++ b/VSs.c Tue Sep 25 16:12:40 2012 +0200 @@ -281,10 +281,11 @@ { VSsSemEnv *semanticEnv; semanticEnv = _VMSMasterEnv->semanticEnv; + + #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC FILE* output; int n; - char filename[255]; - #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC + char filename[255]; //UCC for(n=0;n<255;n++) { @@ -370,27 +371,30 @@ freeListOfArrays(semanticEnv->hwArcs); #endif -#ifdef HOLISTIC__TURN_ON_PERF_COUNTERS - for(n=0;n<255;n++) +#ifdef HOLISTIC__TURN_ON_PERF_COUNTERS + FILE* output2; + int n2; + char filename2[255]; + for(n2=0;n2<255;n2++) { - sprintf(filename, "./counters/Counters.%d.csv",n); - output = fopen(filename,"r"); - if(output) + sprintf(filename2, "./counters/Counters.%d.csv",n2); + output2 = fopen(filename2,"r"); + if(output2) { - fclose(output); + fclose(output2); }else{ break; } } - if(n<255){ - printf("Saving Counter measurements to File: %s ...\n", filename); - output = fopen(filename,"w+"); - if(output!=NULL){ - set_counter_file(output); + if(n2<255){ + printf("Saving Counter measurements to File: %s ...\n", filename2); + output2 = fopen(filename2,"w+"); + if(output2!=NULL){ + set_counter_file(output2); int i; for(i=0;icounterList[i], &print_counter_events_to_file ); - fflush(output); + fflush(output2); } } else @@ -447,7 +451,7 @@ */ void VSs__end_thread( SlaveVP *thdToEnd ) - { VSsSemData *semData; + { VMS_WL__send_dissipate_req( thdToEnd ); } @@ -475,7 +479,7 @@ VMS_WL__send_sem_request( &reqData, animSlv ); } -inline int32 * +int32 * VSs__create_taskID_of_size( int32 numInts, SlaveVP *animSlv ) { int32 *taskID; @@ -544,7 +548,7 @@ //========================== send and receive ============================ // -inline int32 * +int32 * VSs__give_self_taskID( SlaveVP *animSlv ) { return ((VSsSemData*)animSlv->semanticData)->taskStub->taskID; @@ -726,7 +730,7 @@ VMS_WL__send_sem_request( &reqData, animSlv ); -EndSingletonInstrAddr: +//EndSingletonInstrAddr: return; } diff -r 58a71af04cd1 -r a7ca8f45c1c4 VSs.h --- a/VSs.h Mon Sep 17 11:07:07 2012 +0200 +++ b/VSs.h Tue Sep 25 16:12:40 2012 +0200 @@ -19,8 +19,8 @@ * But counter recording still functional, can build constraintless display * with wallclock time */ -#define EXTERNAL_SCHEDULER -#define SIMULATE_EXTERNAL_SCHEDULER +//#define EXTERNAL_SCHEDULER +//#define SIMULATE_EXTERNAL_SCHEDULER //=========================================================================== #define NUM_STRUCS_IN_SEM_ENV 1000 @@ -305,7 +305,7 @@ void VSs__submit_task( VSsTaskType *taskType, void *args, SlaveVP *animSlv); -inline int32 * +int32 * VSs__create_taskID_of_size( int32 numInts, SlaveVP *animSlv ); void @@ -320,7 +320,7 @@ VSs__taskwait(SlaveVP *animSlv); -inline int32 * +int32 * VSs__give_self_taskID( SlaveVP *animSlv ); void @@ -386,6 +386,9 @@ void idle_fn(void* data, SlaveVP *animatingSlv); +void +resume_slaveVP(SlaveVP *slave, VSsSemEnv *semEnv); + //===================== Measurement of Lang Overheads ===================== #include "Measurement/VSs_Measurement.h" diff -r 58a71af04cd1 -r a7ca8f45c1c4 VSs_PluginFns.c --- a/VSs_PluginFns.c Mon Sep 17 11:07:07 2012 +0200 +++ b/VSs_PluginFns.c Tue Sep 25 16:12:40 2012 +0200 @@ -19,13 +19,13 @@ void resume_slaveVP(SlaveVP *slave, VSsSemEnv *semEnv); -inline void +void handleSemReq(VMSReqst *req, SlaveVP *requestingSlv, VSsSemEnv *semEnv); -inline void +void handleDissipate(SlaveVP *requestingSlv, VSsSemEnv *semEnv); -inline void +void handleCreate(VMSReqst *req, SlaveVP *requestingSlv, VSsSemEnv *semEnv); //============================== Assigner ================================== @@ -229,7 +229,7 @@ } -inline void +void handleSemReq(VMSReqst *req, SlaveVP *reqSlv, VSsSemEnv *semEnv) { VSsSemReq *semReq; @@ -271,6 +271,8 @@ break; case trans_end: handleTransEnd(semReq, reqSlv, semEnv); break; + default: + break; } } @@ -281,7 +283,7 @@ /*SlaveVP dissipate -- this is NOT task-end!, only call this to get rid of * extra task slaves, and to end explicitly created threads */ -inline void +void handleDissipate(SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsSemData *semData; VSsTaskStub *parentTaskStub, *ownTaskStub; @@ -345,7 +347,7 @@ /*Re-use this in the entry-point fn */ -inline SlaveVP * +SlaveVP * VSs__create_slave_helper(TopLevelFnPtr fnPtr, void *initData, VSsSemEnv *semEnv, int32 coreToAssignOnto) { SlaveVP *newSlv; @@ -421,7 +423,7 @@ * Then, put the task stub into the slave's semantic Data. *When the slave calls dissipate, have to recycle the task stub. */ -inline void +void handleCreate(VMSReqst *req, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsSemReq *semReq; SlaveVP *newSlv; diff -r 58a71af04cd1 -r a7ca8f45c1c4 VSs_Request_Handlers.c --- a/VSs_Request_Handlers.c Mon Sep 17 11:07:07 2012 +0200 +++ b/VSs_Request_Handlers.c Tue Sep 25 16:12:40 2012 +0200 @@ -10,6 +10,7 @@ #include "VMS_impl/VMS.h" #include "Queue_impl/PrivateQueue.h" #include "Hash_impl/PrivateHash.h" +#include "ListOfArrays/ListOfArrays.h" #include "VSs.h" #include "VSs_Request_Handlers.h" @@ -20,8 +21,7 @@ //=========================== Local Fn Prototypes =========================== -void -resume_slaveVP(SlaveVP *slave, VSsSemEnv *semEnv); + @@ -46,7 +46,7 @@ } HashEntry * -giveEntryElseInsertReqst32(int32 *key, VSsSemReq *semReq, +giveEntryElseInsertReqst32(uint32 *key, VSsSemReq *semReq, HashTable *commHashTbl) { HashEntry *entry; VSsSemReq *waitingReq; @@ -84,7 +84,7 @@ /*malloc's space and initializes fields -- and COPIES the arg values * to new space */ -inline VSsTaskStub * +VSsTaskStub * create_task_stub(VSsTaskType *taskType, void **args) { void **newArgs; VSsTaskStub* newStub = VMS_int__malloc(sizeof (VSsTaskStub) + taskType->sizeOfArgs); @@ -109,7 +109,7 @@ return newStub; } -inline VSsTaskStubCarrier * +VSsTaskStubCarrier * create_task_carrier(VSsTaskStub *taskStub, int32 argNum, int32 rdOrWrite) { VSsTaskStubCarrier *newCarrier; @@ -117,6 +117,8 @@ newCarrier->taskStub = taskStub; newCarrier->argNum = argNum; newCarrier->isReader = rdOrWrite == READER; + + return newCarrier; } //========================================================================== @@ -220,7 +222,7 @@ * *That should be it -- that should work. */ -inline void +void handleSubmitTask(VSsSemReq *semReq, VSsSemEnv *semEnv) { uint32 key[3]; HashEntry *rawHashEntry; //has char *, but use with uint32 * @@ -374,7 +376,7 @@ *TODO: Might be safe to delete an entry when task ends and waiterQ empty * and no readers and no writers.. */ -inline void +void handleEndTask(VSsSemReq *semReq, VSsSemEnv *semEnv) { VSsPointerEntry *ptrEntry; //contents of hash table entry for an arg pointer void **args; @@ -584,7 +586,7 @@ return; } -inline void +void free_task_stub(VSsTaskStub *stubToFree) { if(stubToFree->ptrEntries != NULL ) //a thread stub has NULL entry { VMS_PI__free( stubToFree->ptrEntries ); @@ -608,11 +610,12 @@ * separate tasks can send to the same receiver, and doing hash on the * receive task, so they will stack up. */ -inline void +void handleSendTypeTo(VSsSemReq *semReq, VSsSemEnv *semEnv) { SlaveVP *senderSlv, *receiverSlv; int32 *senderID, *receiverID; - int32 *key, keySz, receiverIDNumInt; + int32 keySz, receiverIDNumInt; + uint32 *key; VSsSemReq *waitingReq; HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; @@ -711,11 +714,12 @@ */ //TODO: combine both send handlers into single handler -inline void +void handleSendFromTo(VSsSemReq *semReq, VSsSemEnv *semEnv) { SlaveVP *senderSlv, *receiverSlv; int32 *senderID, *receiverID; - int32 *key, keySz, receiverIDNumInt, senderIDNumInt; + int32 keySz, receiverIDNumInt, senderIDNumInt; + uint32 *key; VSsSemReq *waitingReq; HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; @@ -792,11 +796,12 @@ //============================== Receives =========================== // -inline void +void handleReceiveTypeTo(VSsSemReq *semReq, VSsSemEnv *semEnv) { SlaveVP *senderSlv, *receiverSlv; int32 *receiverID; - int32 *key, keySz, receiverIDNumInt; + int32 keySz, receiverIDNumInt; + uint32 *key; VSsSemReq *waitingReq; HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; @@ -879,11 +884,12 @@ /* */ -inline void +void handleReceiveFromTo(VSsSemReq *semReq, VSsSemEnv *semEnv) { SlaveVP *senderSlv, *receiverSlv; int32 *senderID, *receiverID; - int32 *key, keySz, receiverIDNumInt, senderIDNumInt; + int32 keySz, receiverIDNumInt, senderIDNumInt; + uint32 *key; VSsSemReq *waitingReq; HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; @@ -916,7 +922,11 @@ //At this point, know have a request to rendez-vous -- should be send if (waitingReq->reqType == send_from_to) { //waiting request is a send, so pair it with this receive -#ifdef HOLISTIC__TURN_ON_OBSERVE_UCC + + //have receiver slave, now set sender slave + senderSlv = waitingReq->senderSlv; + + #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC Dependency newd; newd.from_vp = senderSlv->slaveID; newd.from_task = senderSlv->assignCount; @@ -924,10 +934,7 @@ newd.to_task = receiverSlv->assignCount + 1; //addToListOfArraysDependency(newd,semEnv->commDependenciesList); addToListOfArrays(Dependency, newd, semEnv->commDependenciesList); -#endif - - //have receiver slave, now set sender slave - senderSlv = waitingReq->senderSlv; + #endif //For from-to, should only ever be a single reqst waiting tobe paird entry->content = waitingReq->nextReqInHashEntry; @@ -951,7 +958,7 @@ //========================================================================== -inline void +void replaceWithNewSlotSlvIfNeeded( SlaveVP *requestingSlv, VSsSemEnv *semEnv ) { SlaveVP *newSlotSlv; VSsSemData *semData, *reqSemData; @@ -989,7 +996,7 @@ semData->slaveType = ExtraTaskSlv; } -inline void +void handleTaskwait(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsTaskStub* requestingTaskStub; VSsSemData* semData; @@ -1043,7 +1050,7 @@ /*Uses ID as index into array of flags. If flag already set, resumes from * end-label. Else, sets flag and resumes normally. */ -void inline +void handleStartSingleton_helper(VSsSingleton *singleton, SlaveVP *reqstingSlv, VSsSemEnv *semEnv) { if (singleton->hasFinished) { //the code that sets the flag to true first sets the end instr addr @@ -1069,7 +1076,7 @@ } } -void inline +void handleStartFnSingleton(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsSingleton *singleton; @@ -1079,7 +1086,7 @@ handleStartSingleton_helper(singleton, requestingSlv, semEnv); } -void inline +void handleStartDataSingleton(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsSingleton *singleton; @@ -1097,7 +1104,7 @@ handleStartSingleton_helper(singleton, requestingSlv, semEnv); } -void inline +void handleEndSingleton_helper(VSsSingleton *singleton, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { PrivQueueStruc *waitQ; @@ -1106,7 +1113,7 @@ if (singleton->hasFinished) { //by definition, only one slave should ever be able to run end singleton // so if this is true, is an error - ERROR1("singleton code ran twice", requestingSlv); + ERROR("singleton code ran twice"); } singleton->hasFinished = TRUE; @@ -1134,7 +1141,7 @@ } -void inline +void handleEndFnSingleton(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsSingleton *singleton; @@ -1145,7 +1152,7 @@ handleEndSingleton_helper(singleton, requestingSlv, semEnv); } -void inline +void handleEndDataSingleton(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv) { VSsSingleton *singleton; diff -r 58a71af04cd1 -r a7ca8f45c1c4 VSs_Request_Handlers.h --- a/VSs_Request_Handlers.h Mon Sep 17 11:07:07 2012 +0200 +++ b/VSs_Request_Handlers.h Tue Sep 25 16:12:40 2012 +0200 @@ -14,47 +14,47 @@ /*This header defines everything specific to the VSs semantic plug-in */ -inline void +void handleSubmitTask( VSsSemReq *semReq, VSsSemEnv *semEnv); -inline void +void handleEndTask( VSsSemReq *semReq, VSsSemEnv *semEnv); -inline void +void handleSendTypeTo( VSsSemReq *semReq, VSsSemEnv *semEnv); -inline void +void handleSendFromTo( VSsSemReq *semReq, VSsSemEnv *semEnv); -inline void +void handleReceiveTypeTo( VSsSemReq *semReq, VSsSemEnv *semEnv); -inline void +void handleReceiveFromTo( VSsSemReq *semReq, VSsSemEnv *semEnv); -inline void +void handleTaskwait(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv); -inline void +void handleMalloc( VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv); -inline void +void handleFree( VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv ); -inline void +void handleTransEnd(VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv*semEnv); -inline void +void handleTransStart( VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv ); -inline void +void handleAtomic( VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv); -inline void +void handleStartFnSingleton( VSsSemReq *semReq, SlaveVP *reqstingSlv, VSsSemEnv *semEnv ); -inline void +void handleEndFnSingleton( VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv ); -inline void +void handleStartDataSingleton( VSsSemReq *semReq, SlaveVP *reqstingSlv, VSsSemEnv *semEnv ); -inline void +void handleEndDataSingleton( VSsSemReq *semReq, SlaveVP *requestingSlv, VSsSemEnv *semEnv ); -inline void +void free_task_stub( VSsTaskStub *stubToFree ); -inline void +void replaceWithNewSlotSlvIfNeeded( SlaveVP *requestingSlv, VSsSemEnv *semEnv );