diff 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
line diff
     1.1 --- a/VSs.c	Mon Oct 29 16:57:56 2012 +0100
     1.2 +++ b/VSs.c	Thu Dec 27 12:27:45 2012 +0100
     1.3 @@ -205,6 +205,7 @@
     1.4  
     1.5     semanticEnv->shutdownInitiated = FALSE;
     1.6     semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) );
     1.7 +   semanticEnv->numCoresDone = 0;
     1.8        //For each animation slot, there is an idle slave, and an initial
     1.9        // slave assigned as the current-task-slave.  Create them here.
    1.10     SlaveVP *idleSlv, *slotTaskSlv;
    1.11 @@ -212,11 +213,14 @@
    1.12      { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown
    1.13      
    1.14        for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum )
    1.15 -       { idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
    1.16 +        {
    1.17 +#ifdef IDLE_SLAVES
    1.18 +         idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
    1.19           idleSlv->coreAnimatedBy                = coreNum;
    1.20           idleSlv->animSlotAssignedTo            =
    1.21                                 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
    1.22           semanticEnv->idleSlv[coreNum][slotNum] = idleSlv;
    1.23 +#endif
    1.24           
    1.25           slotTaskSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
    1.26           slotTaskSlv->coreAnimatedBy            = coreNum;
    1.27 @@ -240,6 +244,8 @@
    1.28     
    1.29     semanticEnv->nextCoreToGetNewSlv = 0;
    1.30     
    1.31 +   semanticEnv->numInFlightTasks = 0;
    1.32 +   semanticEnv->deferredSubmitsQ = makeVMSQ();
    1.33  #ifdef EXTERNAL_SCHEDULER
    1.34     VSs__init_ext_scheduler();
    1.35  #endif
    1.36 @@ -410,17 +416,30 @@
    1.37     }
    1.38      
    1.39  #endif
    1.40 -/* It's all allocated inside VMS's big chunk -- that's about to be freed, so
    1.41 - *  nothing to do here
    1.42 -   
    1.43 +    /* It's all allocated inside VMS's big chunk -- that's about to be freed, so
    1.44 +     *  nothing to do here */
    1.45 +/*
    1.46 +    int coreIdx, slotIdx;
    1.47 +    SlaveVP* slotSlv;
    1.48 +    for (coreIdx = 0; coreIdx < NUM_CORES; coreIdx++) {
    1.49 +        for (slotIdx = 0; slotIdx < NUM_ANIM_SLOTS; slotIdx++) {
    1.50 +            slotSlv = semanticEnv->slotTaskSlvs[coreIdx][slotIdx];
    1.51 +            VMS_int__free(slotSlv->semanticData);
    1.52 +            VMS_int__free( slotSlv->startOfStack );
    1.53 +            VMS_int__free( slotSlv );
    1.54 +#ifdef IDLE_SLAVES
    1.55 +            slotSlv = semanticEnv->idleSlv[coreIdx][slotIdx];
    1.56 +            VMS_int__free(slotSlv->semanticData);
    1.57 +            VMS_int__free( slotSlv->startOfStack );
    1.58 +            VMS_int__free( slotSlv );            
    1.59 +#endif
    1.60 +        }
    1.61 +    }
    1.62  
    1.63 -   for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
    1.64 -    {
    1.65 -      VMS_int__free( semanticEnv->readyVPQs[coreIdx]->startOfData );
    1.66 -      VMS_int__free( semanticEnv->readyVPQs[coreIdx] );
    1.67 -    }
    1.68 -   VMS_int__free( semanticEnv->readyVPQs );
    1.69 -   
    1.70 +    freePrivQ(semanticEnv->freeExtraTaskSlvQ);
    1.71 +    freePrivQ(semanticEnv->slavesReadyToResumeQ);
    1.72 +    freePrivQ(semanticEnv->taskReadyQ);
    1.73 +   freeHashTable( semanticEnv->argPtrHashTbl );
    1.74     freeHashTable( semanticEnv->commHashTbl );
    1.75     VMS_int__free( _VMSMasterEnv->semanticEnv );
    1.76   */