#include <MultiThreadSpikeScheduler.h>
Public Member Functions | |
MultiThreadSpikeScheduler (int numThreads, MTSpikeRoutingTables &tables, vector< PropagatedSpikeBuffer * > &stBuffers, SimParameter &sp) | |
Constructor. | |
virtual | ~MultiThreadSpikeScheduler () |
virtual void | scheduleSpike (local_objectid_t senderid, float offsetFraction, engineid_t engine=0) |
Schedules an occured spike in the PropagatedSpikeBuffers. | |
virtual void | deliverSpikes (SpikeReceiverList &listActiveSynapses, engineid_t engine, double simTime, int stepOffset=0) |
Delivers the spikes scheduled for the current time step. | |
virtual void | reset () |
Reset the state of the spike scheduler (and empties all the spike buffers inside), so that the simulation can begin at time = 0. | |
virtual void | advance (engineid_t engine=0) |
Informs that a single thread sim engine has advanced one time step, so that the SpikeScheduler can appropriately setup time offsets for spike scheduling. | |
virtual void | nextCycle () |
Informs the spike scheduler that the simulation is advanced to the next simulation cycle. | |
Protected Attributes | |
int | _numThreads |
Number of threads the multi-threaded simulation engine is using. | |
vector < SingleThreadSpikeScheduler > | STschedulers |
Array of single thread schedulers for scheduling the spikes within one single thread sim engine. | |
MTSpikeRoutingTables & | rtables |
reference to MTSpikeRoutingTables which the scheduler is using for routing the spikes. | |
NodeLocalMultiTargetDelayMap & | mTDelayMap |
reference to NodeLocalMultiTargetDelayMap taken from rtables object for faster access. | |
SpikeTargetGroupPool & | tgtGrpPool |
reference to SpikeTargetGroupPool taken from rtables object for faster access. | |
SimParameter & | _simParam |
General parameter of the simulation. | |
vector< PropagatedSpikeBuffer * > & | STbuffers |
Separated PropagatedSpikeBuffers for the single thread schedulers. | |
MTPropagatedSpikeBuffers | mTSpikeBuffers |
The buffers for inter-engine spike scheduling. | |
int * | engineSteps |
Array holding the relative number of steps each engine has advanced within one cycle of simulation. | |
int | nCycleSteps |
Number of time steps one cycle lasts = minDelay. |
Specialization of the abstract SpikeScheduler class which handles the spike scheduling (routing, scheduling for later time steps) and delivering afterwards for the multi-threaded case.
This class is used by a DistributedSpikeScheduler for the distributed case.
Definition at line 21 of file MultiThreadSpikeScheduler.h.
MultiThreadSpikeScheduler::MultiThreadSpikeScheduler | ( | int | numThreads, | |
MTSpikeRoutingTables & | tables, | |||
vector< PropagatedSpikeBuffer * > & | stBuffers, | |||
SimParameter & | sp | |||
) |
Constructor.
numThreads | Number of threads used in the multi-threaded simulation. | |
tables | Container of the spike routing tables. | |
stBuffers | Array of propagated spike buffers that are used by SingleThreadSpikeScheduler for storing the spikes data. | |
sp | structure holding general parameters about the simulation. |
Definition at line 3 of file MultiThreadSpikeScheduler.cpp.
References _numThreads, _simParam, SimParameter::dt, engineSteps, Time::in_steps(), MTSpikeRoutingTables::localDelayMaps, SimParameter::minDelay, nCycleSteps, rtables, STbuffers, STschedulers, and tgtGrpPool.
MultiThreadSpikeScheduler::~MultiThreadSpikeScheduler | ( | ) | [virtual] |
void MultiThreadSpikeScheduler::scheduleSpike | ( | local_objectid_t | senderid, | |
float | offsetFraction, | |||
engineid_t | engine = 0 | |||
) | [virtual] |
Schedules an occured spike in the PropagatedSpikeBuffers.
Implements SpikeScheduler.
Definition at line 40 of file MultiThreadSpikeScheduler.cpp.
References NodeLocalMultiTargetDelayMap::beginDelays(), MTPropagatedSpikeBuffers::buffers, NodeLocalMultiTargetDelayMap::endDelays(), engineSteps, NodeLocalMultiTargetDelayMap::lastDestEngine(), mTDelayMap, mTSpikeBuffers, and STschedulers.
void MultiThreadSpikeScheduler::deliverSpikes | ( | SpikeReceiverList & | listActiveSynapses, | |
engineid_t | engine = 0 , |
|||
double | simTime = -1 , |
|||
int | stepOffset = 0 | |||
) | [virtual] |
Delivers the spikes scheduled for the current time step.
listActiveSynapses | adds all the waken-up spike receiver objects by the delivered spikes | |
engine | identifier of the single threaded engine for which objects to deliver the spikes. | |
time | Current time of the simulation, used to inform the target objects about the exact time of the delivered spikes. | |
stepOffset | time offset convenient for advance delivering of later spikes which arrive after stepOffset timesteps with respect to the current simulation time. |
Implements SpikeScheduler.
Definition at line 97 of file MultiThreadSpikeScheduler.cpp.
References _numThreads, _simParam, SpikeTargetGroupPool::beginSpikeTargetGroup(), MTPropagatedSpikeBuffers::buffers, SpikeEvent::delta, SimParameter::dt, SpikeTargetGroupPool::endSpikeTargetGroup(), engineSteps, SimObject::getChainedObject(), Time::in_sec(), mTSpikeBuffers, SPIKEHITFLAG_ACTIVATE, STschedulers, tgtGrpPool, and SimObject::toBeActivated().
void MultiThreadSpikeScheduler::reset | ( | ) | [virtual] |
Reset the state of the spike scheduler (and empties all the spike buffers inside), so that the simulation can begin at time = 0.
Implements SpikeScheduler.
Definition at line 65 of file MultiThreadSpikeScheduler.cpp.
References _numThreads, _simParam, MTPropagatedSpikeBuffers::buffers, SimParameter::dt, engineSteps, Time::in_steps(), SimParameter::maxDelay, SimParameter::minDelay, mTSpikeBuffers, and STschedulers.
Referenced by MultiThreadNetwork::_reset_().
void MultiThreadSpikeScheduler::advance | ( | engineid_t | engine = 0 |
) | [virtual] |
Informs that a single thread sim engine has advanced one time step, so that the SpikeScheduler can appropriately setup time offsets for spike scheduling.
The scheduler advances the propagated spike buffers and other state variables that hold simulation timestep information.
engine | id of the single thread engine that has advanced |
Implements SpikeScheduler.
Definition at line 59 of file MultiThreadSpikeScheduler.cpp.
References engineSteps, and STschedulers.
void MultiThreadSpikeScheduler::nextCycle | ( | ) | [virtual] |
Informs the spike scheduler that the simulation is advanced to the next simulation cycle.
Used to update the state of the propagated spike buffers etc.
Implements SpikeScheduler.
Definition at line 80 of file MultiThreadSpikeScheduler.cpp.
References _numThreads, MTPropagatedSpikeBuffers::buffers, engineSteps, and mTSpikeBuffers.
int MultiThreadSpikeScheduler::_numThreads [protected] |
Number of threads the multi-threaded simulation engine is using.
Definition at line 89 of file MultiThreadSpikeScheduler.h.
Referenced by deliverSpikes(), MultiThreadSpikeScheduler(), nextCycle(), and reset().
vector<SingleThreadSpikeScheduler> MultiThreadSpikeScheduler::STschedulers [protected] |
Array of single thread schedulers for scheduling the spikes within one single thread sim engine.
Definition at line 92 of file MultiThreadSpikeScheduler.h.
Referenced by advance(), deliverSpikes(), MultiThreadSpikeScheduler(), reset(), and scheduleSpike().
MTSpikeRoutingTables& MultiThreadSpikeScheduler::rtables [protected] |
reference to MTSpikeRoutingTables which the scheduler is using for routing the spikes.
Definition at line 95 of file MultiThreadSpikeScheduler.h.
Referenced by MultiThreadSpikeScheduler().
reference to NodeLocalMultiTargetDelayMap taken from rtables object for faster access.
Definition at line 98 of file MultiThreadSpikeScheduler.h.
Referenced by scheduleSpike().
reference to SpikeTargetGroupPool taken from rtables object for faster access.
Definition at line 101 of file MultiThreadSpikeScheduler.h.
Referenced by deliverSpikes(), and MultiThreadSpikeScheduler().
SimParameter& MultiThreadSpikeScheduler::_simParam [protected] |
General parameter of the simulation.
Definition at line 104 of file MultiThreadSpikeScheduler.h.
Referenced by deliverSpikes(), MultiThreadSpikeScheduler(), and reset().
vector<PropagatedSpikeBuffer*>& MultiThreadSpikeScheduler::STbuffers [protected] |
Separated PropagatedSpikeBuffers for the single thread schedulers.
Definition at line 107 of file MultiThreadSpikeScheduler.h.
Referenced by MultiThreadSpikeScheduler().
The buffers for inter-engine spike scheduling.
Definition at line 110 of file MultiThreadSpikeScheduler.h.
Referenced by deliverSpikes(), nextCycle(), reset(), and scheduleSpike().
int* MultiThreadSpikeScheduler::engineSteps [protected] |
Array holding the relative number of steps each engine has advanced within one cycle of simulation.
Definition at line 113 of file MultiThreadSpikeScheduler.h.
Referenced by advance(), deliverSpikes(), MultiThreadSpikeScheduler(), nextCycle(), reset(), scheduleSpike(), and ~MultiThreadSpikeScheduler().
int MultiThreadSpikeScheduler::nCycleSteps [protected] |
Number of time steps one cycle lasts = minDelay.
Definition at line 117 of file MultiThreadSpikeScheduler.h.
Referenced by MultiThreadSpikeScheduler().