Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VSs_impls > VSs__MC_shared_impl
diff VSs.c @ 6:1780f6b00e3d
Not working -- checkpoint while making explicitly created VPs work, and DKU pattern
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 01 Aug 2012 00:18:53 -0700 |
| parents | 8188c5b4bfd7 |
| children | 3999b8429ddd |
line diff
1.1 --- a/VSs.c Fri Jul 13 17:35:49 2012 +0200 1.2 +++ b/VSs.c Wed Aug 01 00:18:53 2012 -0700 1.3 @@ -73,8 +73,10 @@ 1.4 */ 1.5 void 1.6 VSs__create_seed_slave_and_do_work( TopLevelFnPtr fnPtr, void *initData ) 1.7 - { VSsSemEnv *semEnv; 1.8 - SlaveVP *seedSlv; 1.9 + { VSsSemEnv *semEnv; 1.10 + SlaveVP *seedSlv; 1.11 + VSsSemData *semData; 1.12 + VSsTaskStub *explPrTaskStub; 1.13 1.14 VSs__init(); //normal multi-thd 1.15 1.16 @@ -83,12 +85,18 @@ 1.17 //VSs starts with one processor, which is put into initial environ, 1.18 // and which then calls create() to create more, thereby expanding work 1.19 seedSlv = VSs__create_slave_helper( fnPtr, initData, 1.20 - semEnv, semEnv->nextCoreToGetNewSlv++ ); 1.21 + semEnv, semEnv->nextCoreToGetNewSlv++ ); 1.22 1.23 - //seedVP doesn't do tasks 1.24 - ((VSsSemData *)seedSlv->semanticData)->needsTaskAssigned = FALSE; 1.25 + //seed slave is an explicit processor, so make one of the special 1.26 + // task stubs for explicit processors, and attach it to the slave 1.27 + explPrTaskStub = create_expl_proc_task_stub( initData ); 1.28 + 1.29 + semData = (VSsSemData *)seedSlv->semanticData; 1.30 + //seedVP already has a permanent task 1.31 + semData->needsTaskAssigned = FALSE; 1.32 + semData->taskStub = explPrTaskStub; 1.33 1.34 - resume_slaveVP( seedSlv, semEnv ); 1.35 + resume_slaveVP( seedSlv, semEnv ); //returns right away, just queues Slv 1.36 1.37 VMS_SS__start_the_work_then_wait_until_done(); //normal multi-thd 1.38 1.39 @@ -169,8 +177,7 @@ 1.40 void 1.41 VSs__init_Helper() 1.42 { VSsSemEnv *semanticEnv; 1.43 - PrivQueueStruc **readyVPQs; 1.44 - int coreIdx, i, j; 1.45 + int32 i, coreNum, slotNum; 1.46 1.47 //Hook up the semantic layer's plug-ins to the Master virt procr 1.48 _VMSMasterEnv->requestHandler = &VSs__Request_Handler; 1.49 @@ -190,43 +197,35 @@ 1.50 1.51 semanticEnv->shutdownInitiated = FALSE; 1.52 semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) ); 1.53 - for( i = 0; i < NUM_CORES; ++i ) 1.54 - { semanticEnv->coreIsDone[i] = FALSE; 1.55 - for( j = 0; j < NUM_ANIM_SLOTS; ++j ) 1.56 - { 1.57 - semanticEnv->idleSlv[i][j] = VMS_int__create_slaveVP(&idle_fn,NULL); 1.58 - semanticEnv->idleSlv[i][j]->coreAnimatedBy = i; 1.59 + //For each animation slot, there is an idle slave, and an initial 1.60 + // slave assigned as the current-task-slave. Create them here. 1.61 + SlaveVP *idleSlv, *currTaskSlv; 1.62 + for( coreNum = 0; coreNum < NUM_CORES; coreNum++ ) 1.63 + { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown 1.64 + 1.65 + for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum ) 1.66 + { idleSlv = VMS_int__create_slaveVP(&idle_fn,NULL); 1.67 + idleSlv->coreAnimatedBy = coreNum; 1.68 + idleSlv->animSlotAssignedTo = slotNum; 1.69 + semanticEnv->idleSlv[coreNum][slotNum] = idleSlv; 1.70 + 1.71 + currTaskSlv = VMS_int__create_slaveVP( &idle_fn, NULL ); 1.72 + currTaskSlv->coreAnimatedBy = coreNum; 1.73 + currTaskSlv->animSlotAssignedTo = slotNum; 1.74 + semanticEnv->currTaskSlvs[coreNum][slotNum] = currTaskSlv; 1.75 } 1.76 } 1.77 1.78 - #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 1.79 - semanticEnv->unitList = makeListOfArrays(sizeof(Unit),128); 1.80 - semanticEnv->ctlDependenciesList = makeListOfArrays(sizeof(Dependency),128); 1.81 - semanticEnv->commDependenciesList = makeListOfArrays(sizeof(Dependency),128); 1.82 - semanticEnv->dynDependenciesList = makeListOfArrays(sizeof(Dependency),128); 1.83 - semanticEnv->ntonGroupsInfo = makePrivDynArrayOfSize((void***)&(semanticEnv->ntonGroups),8); 1.84 - 1.85 - semanticEnv->hwArcs = makeListOfArrays(sizeof(Dependency),128); 1.86 - memset(semanticEnv->last_in_slot,0,sizeof(NUM_CORES * NUM_ANIM_SLOTS * sizeof(Unit))); 1.87 - #endif 1.88 - 1.89 - //create the ready queue, hash tables used for matching and so forth 1.90 - readyVPQs = VMS_int__malloc( NUM_CORES * sizeof(PrivQueueStruc *) ); 1.91 - 1.92 - for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 1.93 - { 1.94 - readyVPQs[ coreIdx ] = makeVMSQ(); 1.95 - } 1.96 - 1.97 - semanticEnv->readyVPQs = readyVPQs; 1.98 - 1.99 - semanticEnv->taskReadyQ = makeVMSQ(); 1.100 - 1.101 - semanticEnv->nextCoreToGetNewSlv = 0; 1.102 - semanticEnv->numSlaveVP = 0; 1.103 + //create the ready queues, hash tables used for matching and so forth 1.104 + semanticEnv->slavesReadyToResumeQ = makeVMSQ(); 1.105 + semanticEnv->extraTaskSlvQ = makeVMSQ(); 1.106 + semanticEnv->taskReadyQ = makeVMSQ(); 1.107 1.108 semanticEnv->argPtrHashTbl = makeHashTable32( 16, &VMS_int__free ); 1.109 semanticEnv->commHashTbl = makeHashTable32( 16, &VMS_int__free ); 1.110 + 1.111 + semanticEnv->nextCoreToGetNewSlv = 0; 1.112 + 1.113 1.114 //TODO: bug -- turn these arrays into dyn arrays to eliminate limit 1.115 //semanticEnv->singletonHasBeenExecutedFlags = makeDynArrayInfo( ); 1.116 @@ -239,6 +238,19 @@ 1.117 semanticEnv->fnSingletons[i].waitQ = makeVMSQ(); 1.118 semanticEnv->transactionStrucs[i].waitingVPQ = makeVMSQ(); 1.119 } 1.120 + 1.121 + semanticEnv->numAdditionalSlvs = 0; //must be last 1.122 + 1.123 + #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 1.124 + semanticEnv->unitList = makeListOfArrays(sizeof(Unit),128); 1.125 + semanticEnv->ctlDependenciesList = makeListOfArrays(sizeof(Dependency),128); 1.126 + semanticEnv->commDependenciesList = makeListOfArrays(sizeof(Dependency),128); 1.127 + semanticEnv->dynDependenciesList = makeListOfArrays(sizeof(Dependency),128); 1.128 + semanticEnv->ntonGroupsInfo = makePrivDynArrayOfSize((void***)&(semanticEnv->ntonGroups),8); 1.129 + 1.130 + semanticEnv->hwArcs = makeListOfArrays(sizeof(Dependency),128); 1.131 + memset(semanticEnv->last_in_slot,0,sizeof(NUM_CORES * NUM_ANIM_SLOTS * sizeof(Unit))); 1.132 + #endif 1.133 } 1.134 1.135
