comparison VSs.c @ 22:b787a5234406

add task throttle
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Thu, 27 Dec 2012 12:27:45 +0100
parents feea343d202f
children 3787df8b95f9
comparison
equal deleted inserted replaced
18:f5259b2f160f 19:77ee327541ff
203 VSs__init_counter_data_structs(); 203 VSs__init_counter_data_structs();
204 #endif 204 #endif
205 205
206 semanticEnv->shutdownInitiated = FALSE; 206 semanticEnv->shutdownInitiated = FALSE;
207 semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) ); 207 semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) );
208 semanticEnv->numCoresDone = 0;
208 //For each animation slot, there is an idle slave, and an initial 209 //For each animation slot, there is an idle slave, and an initial
209 // slave assigned as the current-task-slave. Create them here. 210 // slave assigned as the current-task-slave. Create them here.
210 SlaveVP *idleSlv, *slotTaskSlv; 211 SlaveVP *idleSlv, *slotTaskSlv;
211 for( coreNum = 0; coreNum < NUM_CORES; coreNum++ ) 212 for( coreNum = 0; coreNum < NUM_CORES; coreNum++ )
212 { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown 213 { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown
213 214
214 for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum ) 215 for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum )
215 { idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0); 216 {
217 #ifdef IDLE_SLAVES
218 idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
216 idleSlv->coreAnimatedBy = coreNum; 219 idleSlv->coreAnimatedBy = coreNum;
217 idleSlv->animSlotAssignedTo = 220 idleSlv->animSlotAssignedTo =
218 _VMSMasterEnv->allAnimSlots[coreNum][slotNum]; 221 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
219 semanticEnv->idleSlv[coreNum][slotNum] = idleSlv; 222 semanticEnv->idleSlv[coreNum][slotNum] = idleSlv;
223 #endif
220 224
221 slotTaskSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0); 225 slotTaskSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
222 slotTaskSlv->coreAnimatedBy = coreNum; 226 slotTaskSlv->coreAnimatedBy = coreNum;
223 slotTaskSlv->animSlotAssignedTo = 227 slotTaskSlv->animSlotAssignedTo =
224 _VMSMasterEnv->allAnimSlots[coreNum][slotNum]; 228 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
238 semanticEnv->argPtrHashTbl = makeHashTable32( 16, &VMS_int__free ); 242 semanticEnv->argPtrHashTbl = makeHashTable32( 16, &VMS_int__free );
239 semanticEnv->commHashTbl = makeHashTable32( 16, &VMS_int__free ); 243 semanticEnv->commHashTbl = makeHashTable32( 16, &VMS_int__free );
240 244
241 semanticEnv->nextCoreToGetNewSlv = 0; 245 semanticEnv->nextCoreToGetNewSlv = 0;
242 246
247 semanticEnv->numInFlightTasks = 0;
248 semanticEnv->deferredSubmitsQ = makeVMSQ();
243 #ifdef EXTERNAL_SCHEDULER 249 #ifdef EXTERNAL_SCHEDULER
244 VSs__init_ext_scheduler(); 250 VSs__init_ext_scheduler();
245 #endif 251 #endif
246 //TODO: bug -- turn these arrays into dyn arrays to eliminate limit 252 //TODO: bug -- turn these arrays into dyn arrays to eliminate limit
247 //semanticEnv->singletonHasBeenExecutedFlags = makeDynArrayInfo( ); 253 //semanticEnv->singletonHasBeenExecutedFlags = makeDynArrayInfo( );
408 } else { 414 } else {
409 printf("Could not open UCC file, please clean \"counters\" folder. (Must contain less than 255 files.)\n"); 415 printf("Could not open UCC file, please clean \"counters\" folder. (Must contain less than 255 files.)\n");
410 } 416 }
411 417
412 #endif 418 #endif
413 /* It's all allocated inside VMS's big chunk -- that's about to be freed, so 419 /* It's all allocated inside VMS's big chunk -- that's about to be freed, so
414 * nothing to do here 420 * nothing to do here */
415 421 /*
416 422 int coreIdx, slotIdx;
417 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 423 SlaveVP* slotSlv;
418 { 424 for (coreIdx = 0; coreIdx < NUM_CORES; coreIdx++) {
419 VMS_int__free( semanticEnv->readyVPQs[coreIdx]->startOfData ); 425 for (slotIdx = 0; slotIdx < NUM_ANIM_SLOTS; slotIdx++) {
420 VMS_int__free( semanticEnv->readyVPQs[coreIdx] ); 426 slotSlv = semanticEnv->slotTaskSlvs[coreIdx][slotIdx];
427 VMS_int__free(slotSlv->semanticData);
428 VMS_int__free( slotSlv->startOfStack );
429 VMS_int__free( slotSlv );
430 #ifdef IDLE_SLAVES
431 slotSlv = semanticEnv->idleSlv[coreIdx][slotIdx];
432 VMS_int__free(slotSlv->semanticData);
433 VMS_int__free( slotSlv->startOfStack );
434 VMS_int__free( slotSlv );
435 #endif
436 }
421 } 437 }
422 VMS_int__free( semanticEnv->readyVPQs ); 438
423 439 freePrivQ(semanticEnv->freeExtraTaskSlvQ);
440 freePrivQ(semanticEnv->slavesReadyToResumeQ);
441 freePrivQ(semanticEnv->taskReadyQ);
442 freeHashTable( semanticEnv->argPtrHashTbl );
424 freeHashTable( semanticEnv->commHashTbl ); 443 freeHashTable( semanticEnv->commHashTbl );
425 VMS_int__free( _VMSMasterEnv->semanticEnv ); 444 VMS_int__free( _VMSMasterEnv->semanticEnv );
426 */ 445 */
427 VMS_SS__cleanup_at_end_of_shutdown(); 446 VMS_SS__cleanup_at_end_of_shutdown();
428 } 447 }