diff VSs.c @ 39:0715109abb08

make wrapper lib for linking against files produced by mercurium (ompss preprocessor) -- ! separates args and dependencies
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Mon, 03 Jun 2013 18:34:56 +0200
parents a951b38d2cfc
children 8733d1299c3a
line diff
     1.1 --- a/VSs.c	Fri May 17 17:49:49 2013 +0200
     1.2 +++ b/VSs.c	Mon Jun 03 18:34:56 2013 +0200
     1.3 @@ -94,7 +94,7 @@
     1.4        // the parent be already ended, and have one child (the seed).  This
     1.5        // will make the dissipate handler do the right thing when the seed
     1.6        // is dissipated.
     1.7 -   threadTaskStub = create_thread_task_stub( initData );
     1.8 +   threadTaskStub = create_thread_task_stub( initData);
     1.9     parentTaskStub = create_thread_task_stub( NULL );
    1.10     parentTaskStub->isEnded = TRUE;
    1.11     parentTaskStub->numLiveChildThreads = 1; //so dissipate works for seed
    1.12 @@ -248,6 +248,7 @@
    1.13     
    1.14     semanticEnv->argPtrHashTbl  = makeHashTable32( 20, &free_pointer_entry );
    1.15     semanticEnv->commHashTbl    = makeHashTable32( 16, &VMS_int__free );
    1.16 +   semanticEnv->criticalHashTbl = makeHashTable32( 16, &VMS_int__free );
    1.17     
    1.18     semanticEnv->nextCoreToGetNewSlv = 0;
    1.19     
    1.20 @@ -266,12 +267,6 @@
    1.21        semanticEnv->fnSingletons[i].hasFinished       = FALSE;
    1.22        semanticEnv->fnSingletons[i].waitQ             = makeVMSQ();
    1.23        semanticEnv->transactionStrucs[i].waitingVPQ   = makeVMSQ();
    1.24 -      semanticEnv->criticalSection[i].isOccupied     = FALSE;
    1.25 -      semanticEnv->criticalSection[i].waitQ          = makeVMSQ();
    1.26 -#ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
    1.27 -      semanticEnv->criticalSection[i].previous.vp    = 0;
    1.28 -      semanticEnv->criticalSection[i].previous.task  = 0;
    1.29 -#endif
    1.30      }
    1.31  
    1.32     semanticEnv->numLiveExtraTaskSlvs   = 0; //must be last
    1.33 @@ -444,7 +439,6 @@
    1.34      for (i = 0; i < NUM_STRUCS_IN_SEM_ENV; i++) {
    1.35          freePrivQ(semanticEnv->fnSingletons[i].waitQ);
    1.36          freePrivQ(semanticEnv->transactionStrucs[i].waitingVPQ);
    1.37 -        freePrivQ(semanticEnv->criticalSection[i].waitQ);
    1.38      }
    1.39  
    1.40      freePrivQ(semanticEnv->freeExtraTaskSlvQ);
    1.41 @@ -453,6 +447,7 @@
    1.42      freePrivQ(semanticEnv->deferredSubmitsQ);
    1.43      freeHashTable(semanticEnv->argPtrHashTbl);
    1.44      freeHashTable(semanticEnv->commHashTbl);
    1.45 +    freeHashTable(semanticEnv->criticalHashTbl);
    1.46      VMS_int__free(semanticEnv->coreIsDone);
    1.47      VMS_int__free(_VMSMasterEnv->semanticEnv);
    1.48  
    1.49 @@ -503,22 +498,23 @@
    1.50  
    1.51  
    1.52  //======================= task submit and end ==============================
    1.53 +
    1.54  /*
    1.55   */
    1.56 -void
    1.57 -VSs__submit_task( VSsTaskType *taskType, void *args)
    1.58 - { VSsSemReq  reqData;
    1.59 +void VSs__submit_task(VSsTaskType *taskType, void *args, void* deps) {
    1.60 +    VSsSemReq reqData;
    1.61  
    1.62 -   reqData.reqType    = submit_task;
    1.63 -   
    1.64 -   reqData.taskType   = taskType;
    1.65 -   reqData.args       = args;
    1.66 -   reqData.callingSlv = currVP;
    1.67 -  
    1.68 -   reqData.taskID     = NULL;
    1.69 - 
    1.70 -   VMS_WL__send_sem_request( &reqData, currVP );
    1.71 - }
    1.72 +    reqData.reqType = submit_task;
    1.73 +
    1.74 +    reqData.taskType = taskType;
    1.75 +    reqData.args = args;
    1.76 +    reqData.deps = deps;
    1.77 +    reqData.callingSlv = currVP;
    1.78 +
    1.79 +    reqData.taskID = NULL;
    1.80 +
    1.81 +    VMS_WL__send_sem_request(&reqData, currVP);
    1.82 +}
    1.83  
    1.84  int32 *
    1.85  VSs__create_taskID_of_size( int32 numInts)
    1.86 @@ -527,21 +523,21 @@
    1.87     taskID    = VMS_WL__malloc( sizeof(int32) + numInts * sizeof(int32) );
    1.88     taskID[0] = numInts;
    1.89     return taskID;
    1.90 - }
    1.91 +}
    1.92  
    1.93 -void
    1.94 -VSs__submit_task_with_ID( VSsTaskType *taskType, void *args, int32 *taskID)
    1.95 - { VSsSemReq  reqData;
    1.96 +void VSs__submit_task_with_ID(VSsTaskType *taskType, void *args, void* deps, int32 *taskID) {
    1.97 +    VSsSemReq reqData;
    1.98  
    1.99 -   reqData.reqType    = submit_task;
   1.100 -   
   1.101 -   reqData.taskType   = taskType;
   1.102 -   reqData.args       = args;
   1.103 -   reqData.taskID     = taskID;
   1.104 -   reqData.callingSlv = currVP;
   1.105 - 
   1.106 -   VMS_WL__send_sem_request( &reqData, currVP );
   1.107 - }
   1.108 +    reqData.reqType = submit_task;
   1.109 +
   1.110 +    reqData.taskType = taskType;
   1.111 +    reqData.args = args;
   1.112 +    reqData.deps = deps;
   1.113 +    reqData.taskID = taskID;
   1.114 +    reqData.callingSlv = currVP;
   1.115 +
   1.116 +    VMS_WL__send_sem_request(&reqData, currVP);
   1.117 +}
   1.118  
   1.119  
   1.120  /*This call is the last to happen in every task.  It causes the slave to
   1.121 @@ -600,25 +596,25 @@
   1.122  }
   1.123  
   1.124  void
   1.125 -VSs__start_critical(int32 name){
   1.126 +VSs__start_critical(void* lock){
   1.127      VSsSemReq  reqData;
   1.128  
   1.129     reqData.reqType      = critical_start;
   1.130     reqData.callingSlv   = currVP;
   1.131     
   1.132 -   reqData.criticalID = name;
   1.133 +   reqData.criticalID = lock;
   1.134     
   1.135     VMS_WL__send_sem_request( &reqData, currVP );
   1.136  }
   1.137  
   1.138  void
   1.139 -VSs__end_critical(int32 name){
   1.140 +VSs__end_critical(void* lock){
   1.141      VSsSemReq  reqData;
   1.142  
   1.143     reqData.reqType      = critical_end;
   1.144     reqData.callingSlv   = currVP;
   1.145     
   1.146 -   reqData.criticalID = name;
   1.147 +   reqData.criticalID = lock;
   1.148     
   1.149     VMS_WL__send_sem_request( &reqData, currVP );
   1.150  }