MultiThreadNetwork Class Reference

Network which encapsulates a multi-threaded simulation in one process on a multi-processor machine. More...

#include <MultiThreadNetwork.h>

Inheritance diagram for MultiThreadNetwork:

Inheritance graph
[legend]
Collaboration diagram for MultiThreadNetwork:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MultiThreadNetwork (int nThreads, SimParameter sp=SimParameter::Default)
 Constructor.
 MultiThreadNetwork (int nThreads, MPI::Intracomm &comm, SimParameter sp=SimParameter::Default)
virtual ~MultiThreadNetwork ()
Adding objects
virtual void _addObject_ (const SimObjectFactory &objFactory, const SimEngine::ID &loc, SimObject::ID &gid)
 The simulation object is added to the network.
virtual void _addObject_ (const SimObjectFactory &objFactory, SimObject::ID &gid)
 One instance of a simulation object is created and added to the network using the current distribution strategy. The SimObject::ID is returned.
Messages
virtual void _addSpikeMessage_ (const SimObject::ID &sender, const port_t out, const SimObject::ID &receiver, const port_t in, const Time &delay)
 Set up a spike message channel with delay in simulation time steps.
virtual void _addAnalogMessage_ (const SimObject::ID &sender, int sender_port, const SimObject::ID &receiver, int recv_port, const Time &delay)
 Setup an analog message channel with delay in simulation time steps.
virtual void _addAnalogMessage_ (const SimObject::ID &sender, int sender_port, const SimObject::ID &receiver, string destfield, const Time &delay)
virtual void _addAnalogMessage_ (const SimObject::ID &sender, string srcfield, const SimObject::ID &receiver, int recv_port, const Time &delay)
virtual void _addAnalogMessage_ (const SimObject::ID &sender, string srcfield, const SimObject::ID &receiver, string destfield, const Time &delay)
Converting between local and global engine IDs
virtual gl_engineid_t maxLocalEngineID (void) const
 Return the largest local simulation engine ID at the executing node.

Protected Member Functions

virtual void _reset_ ()
 Resets the simulation to time = 0.
virtual void _advance_ (int nSteps=1)
 Advances the simulation of the network for a specified number of simulation timesteps.
virtual void _initialize_ ()
 Initializes the network for simulation. To be invoked after construction, and before simulation.
virtual void _mount_ (const SimObjectFactory &objFactory, const SimObject::ID &mountpoint, SimObject::ID &gid)
 One instance of a simulation object is "mounted" to the mount simulation object.
virtual void _insert_ (const SimObjectFactory &objFactory, const SimObject::ID &container, SimObject::ID &gid)
 One instance of a simulation object is "inserted" into the container simulation object. The SimObject::ID of the newly created object is returned.
virtual void _connect_ (SimObject::ID const &src, port_t out, const SimObject::ID &dst, port_t in, int delay)
 Make a connection (i.e. spike or analog message) from the src-out port to the dest-in port.
virtual SimObject_getObject_ (const SimObject::ID &id)
 Get a pointer to a sim object stored in the network.
template<typename srcType, typename destType>
int addGenericAnalogMessage (const SimObject::ID &sender, srcType senderPortOrField, const SimObject::ID &receiver, destType recvPortOrField, delay_t delay)
 Adds a spiking connection pathway between two SimObjects, usualy some Neuron and a Synapse.
virtual void seed_noise_rng (uint32 noise_seed)

Static Protected Member Functions

static void addLocalSpikeMessage (MTSpikeRoutingTables *arg_tables, SimEngine *arg_simEngine, const SimParameter &SP, const SimObject::ID &sender, spike_port_id_t sender_port, const SimObject::ID &receiver, const port_t in_port, step_t delay)

Protected Attributes

int nThreads
 Number of threads the network utilizes to perform simulation.
MTSpikeRoutingTablestables
 Tables used for spike routing in the multi-threaded spike exchange case.
ThreadPool thrPool
 ThreadPool holding thread objects used in multi-thread processing.
vector< PropagatedSpikeBuffer * > STBuffers
 Array of Propagated spike buffers, one for each SingleThreadSimEngine.
MultiThreadSpikeSchedulerspikeScheduler
 Spike scheduler used for scheduling the spikes to appropriate propagated spike buffers.
MultiThreadSimEnginesimEngine
 Engine which runs the simulation in multiple threads, advances sim objects and controls the spike scheduler.
vector
< MultiThreadAnalogMsgDispatcher * > 
analogMsgDispatchers
vector< STAnalogMessageCreator * > stAnalogMsgCreators
MTAnalogMessageCreatormtAnalogMsgCreator
AnalogDelayObjectMapanalogDelayObjectsMap

Friends

class DistributedSingleThreadNetwork
class DistributedMultiThreadNetwork


Detailed Description

Network which encapsulates a multi-threaded simulation in one process on a multi-processor machine.

Used for setup and running simulations on one multi-processor machine (single-node multi-thread scenario). Contains interfaces for construction of the network, i.e. adding SimObject objects (neurons, synapses, etc.) and connecting them, and also used for simulation control.

See also:
DistributedNetwork, SimNetwork

Definition at line 32 of file MultiThreadNetwork.h.


Constructor & Destructor Documentation

MultiThreadNetwork::MultiThreadNetwork ( int  nThreads,
SimParameter  sp = SimParameter::Default 
)

Constructor.

Constructs a multi-thread (DMT) network object on the local node with specified number of threads.

Parameters:
nThreads number of threads the local node uses (on each machine different number of threads may be specified)
simPar is a reference to a SimParameter structur

Definition at line 15 of file MultiThreadNetwork.cpp.

MultiThreadNetwork::MultiThreadNetwork ( int  nThreads,
MPI::Intracomm &  comm,
SimParameter  sp = SimParameter::Default 
)

Definition at line 22 of file MultiThreadNetwork.cpp.

MultiThreadNetwork::~MultiThreadNetwork (  )  [virtual]


Member Function Documentation

void MultiThreadNetwork::_addObject_ ( const SimObjectFactory objFactory,
const SimEngine::ID loc,
SimObject::ID gid 
) [virtual]

The simulation object is added to the network.

The object is added to the list of advancable objects of the network. The network takes over the ownership of the object, i.e. the network will free the memory occupied by the object if necessary.

Parameters:
obj pointer to the SimObject simulation object to be added.
eng Specifies the (local) simulation engine to which the object should be added.
id Resulting identifier of the added object. All four elements (node,engine,type,localid) of the identifier are determined by the network itself during addition. One instance of a simulation object is created by the factory and added at specified simulation engine of the network.
loc Specifies the node and local engine where the object should be added to. loc.node is ignored!
id The resulting unique identifier (node,engine,type,localid) of the created object.

Reimplemented from SimNetwork.

Definition at line 104 of file MultiThreadNetwork.cpp.

References SimNetwork::_mpi_rank, MultiThreadSimEngine::addObject(), SimEngine::ID::engine, SimObject::ID::Invalid, SimEngine::ID::node, and simEngine.

Here is the call graph for this function:

void MultiThreadNetwork::_addObject_ ( const SimObjectFactory objFactory,
SimObject::ID gid 
) [virtual]

One instance of a simulation object is created and added to the network using the current distribution strategy. The SimObject::ID is returned.

Reimplemented from SimNetwork.

Definition at line 129 of file MultiThreadNetwork.cpp.

References SimNetwork::addObject().

Here is the call graph for this function:

void MultiThreadNetwork::_addSpikeMessage_ ( const SimObject::ID sender,
const port_t  out,
const SimObject::ID receiver,
const port_t  in,
const Time delay 
) [virtual]

Set up a spike message channel with delay in simulation time steps.

Each spike of the sender is sent to the given port of receiver (after delay simuation steps)

Reimplemented from SimNetwork.

Definition at line 223 of file MultiThreadNetwork.cpp.

References SimNetwork::_nSpikeMessages, addLocalSpikeMessage(), SimObject::ID::eng, SimNetwork::get_dt(), MultiThreadSimEngine::getObject(), SpikeSender::getSpikePort(), SpikeOutputPort::ID(), Time::in_ms(), Time::in_steps(), SimParameter::maxDelay, SimParameter::minDelay, simEngine, SimNetwork::simParam, tables, and SimObject::ID::toString().

Here is the call graph for this function:

void MultiThreadNetwork::_addAnalogMessage_ ( const SimObject::ID sender,
int  sender_port,
const SimObject::ID receiver,
int  recv_port,
const Time delay 
) [virtual]

Setup an analog message channel with delay in simulation time steps.

Reimplemented from SimNetwork.

Definition at line 271 of file MultiThreadNetwork.cpp.

References SimNetwork::_nAnalogMessages, addGenericAnalogMessage(), SimNetwork::get_dt(), and Time::in_steps().

Here is the call graph for this function:

void MultiThreadNetwork::_addAnalogMessage_ ( const SimObject::ID sender,
int  sender_port,
const SimObject::ID receiver,
string  destfield,
const Time delay 
) [virtual]

Reimplemented from SimNetwork.

Definition at line 277 of file MultiThreadNetwork.cpp.

References SimNetwork::_nAnalogMessages, addGenericAnalogMessage(), SimNetwork::get_dt(), and Time::in_steps().

Here is the call graph for this function:

void MultiThreadNetwork::_addAnalogMessage_ ( const SimObject::ID sender,
string  srcfield,
const SimObject::ID receiver,
int  recv_port,
const Time delay 
) [virtual]

Reimplemented from SimNetwork.

Definition at line 283 of file MultiThreadNetwork.cpp.

References SimNetwork::_nAnalogMessages, addGenericAnalogMessage(), SimNetwork::get_dt(), and Time::in_steps().

Here is the call graph for this function:

void MultiThreadNetwork::_addAnalogMessage_ ( const SimObject::ID sender,
string  srcfield,
const SimObject::ID receiver,
string  destfield,
const Time delay 
) [virtual]

Reimplemented from SimNetwork.

Definition at line 289 of file MultiThreadNetwork.cpp.

References SimNetwork::_nAnalogMessages, addGenericAnalogMessage(), SimNetwork::get_dt(), and Time::in_steps().

Here is the call graph for this function:

gl_engineid_t MultiThreadNetwork::maxLocalEngineID ( void   )  const [virtual]

Return the largest local simulation engine ID at the executing node.

Reimplemented from SimNetwork.

Definition at line 297 of file MultiThreadNetwork.cpp.

void MultiThreadNetwork::_reset_ (  )  [protected, virtual]

Resets the simulation to time = 0.

Discardes the pending spikes and reinitalizes the states of the sim objects.

Reimplemented from SimNetwork.

Definition at line 319 of file MultiThreadNetwork.cpp.

References analogMsgDispatchers, SimNetwork::get_dt(), SimNetwork::initialize(), MultiThreadSimEngine::reset(), MultiThreadSpikeScheduler::reset(), SimNetwork::reseted, simEngine, and spikeScheduler.

Here is the call graph for this function:

void MultiThreadNetwork::_advance_ ( int  nSteps = 1  )  [protected, virtual]

Advances the simulation of the network for a specified number of simulation timesteps.

Advancing continues from exactly where the simulation from the previous advance() invocation stopped. reset() should be used to restart the simulation of the network from time = 0.

Parameters:
nSteps number of timesteps the simulation is advanced.

Reimplemented from SimNetwork.

Definition at line 331 of file MultiThreadNetwork.cpp.

References MultiThreadSimEngine::advance(), SimNetwork::reset(), SimNetwork::reseted, and simEngine.

Here is the call graph for this function:

void MultiThreadNetwork::_initialize_ (  )  [protected, virtual]

Initializes the network for simulation. To be invoked after construction, and before simulation.

Reimplemented from SimNetwork.

Definition at line 304 of file MultiThreadNetwork.cpp.

References analogMsgDispatchers, SimParameter::dt, Time::in_steps(), MultiThreadSimEngine::initialize(), SimParameter::minDelay, simEngine, and SimNetwork::simParam.

Here is the call graph for this function:

void MultiThreadNetwork::addLocalSpikeMessage ( MTSpikeRoutingTables arg_tables,
SimEngine arg_simEngine,
const SimParameter SP,
const SimObject::ID sender,
spike_port_id_t  sender_port,
const SimObject::ID receiver,
const port_t  in_port,
step_t  delay 
) [static, protected]

void MultiThreadNetwork::_mount_ ( const SimObjectFactory objFactory,
const SimObject::ID mountpoint,
SimObject::ID gid 
) [protected, virtual]

One instance of a simulation object is "mounted" to the mount simulation object.

Reimplemented from SimNetwork.

Definition at line 136 of file MultiThreadNetwork.cpp.

References SimNetwork::_mpi_rank, SimObject::ID::eng, SimObject::ID::Invalid, MultiThreadSimEngine::mount(), SimObject::ID::node, and simEngine.

Here is the call graph for this function:

void MultiThreadNetwork::_insert_ ( const SimObjectFactory objFactory,
const SimObject::ID container,
SimObject::ID gid 
) [protected, virtual]

One instance of a simulation object is "inserted" into the container simulation object. The SimObject::ID of the newly created object is returned.

Reimplemented from SimNetwork.

Definition at line 161 of file MultiThreadNetwork.cpp.

References SimNetwork::_mpi_rank, SimObject::ID::eng, MultiThreadSimEngine::insert(), SimObject::ID::Invalid, SimObject::ID::node, and simEngine.

Here is the call graph for this function:

void MultiThreadNetwork::_connect_ ( SimObject::ID const &  src,
port_t  out,
const SimObject::ID dst,
port_t  in,
int  delay 
) [protected, virtual]

Make a connection (i.e. spike or analog message) from the src-out port to the dest-in port.

Reimplemented from SimNetwork.

Definition at line 194 of file MultiThreadNetwork.cpp.

References SimNetwork::addAnalogMessage(), SimNetwork::addSpikeMessage(), SimObject::analog, SimNetwork::get_dt(), SimObject::getManagedDelay(), MultiThreadSimEngine::getObject(), SimObject::inputPortType(), SimObject::outputPortType(), Time::sec(), simEngine, SimObject::spiking, Time::steps(), and SimObject::ID::toString().

Here is the call graph for this function:

SimObject * MultiThreadNetwork::_getObject_ ( const SimObject::ID id  )  [protected, virtual]

Get a pointer to a sim object stored in the network.

Objects are uniquely identified in the network by their identifier (node, engine, localid) and their type. Sim objects with different types can have the same identifier, so also the type must be specified.

Parameters:
otype the type of the object to be retrieved.
id Identifier of the object to be retrieved.
Returns:
pointer to the retrieved sim object.

Reimplemented from SimNetwork.

Definition at line 187 of file MultiThreadNetwork.cpp.

References MultiThreadSimEngine::getObject(), and simEngine.

Here is the call graph for this function:

template<typename srcType, typename destType>
int MultiThreadNetwork::addGenericAnalogMessage ( const SimObject::ID sender,
srcType  senderPortOrField,
const SimObject::ID receiver,
destType  recvPortOrField,
delay_t  delay 
) [inline, protected]

Adds a spiking connection pathway between two SimObjects, usualy some Neuron and a Synapse.

Connects the output of a SimObject of Spiking <> type to another SimObject capable of receiving spiking inputs. The spiking pathway can also introduce some delay to the signal.

Parameters:
sender_eng id of the engine where sender belongs.
sender_port id of the spike port which emmits the spike
delay delay of the spiking connection.
recv_type Type of the receiving object.
rec_engine id of the engine where receiver object belongs.
rec_oid local identifier of the receiver sim object.
input port where the spikes arrive in the receiver (The receiver can have many input ports).
void addIntraNodeSpikeMessage( engineid_t sender_eng, spike_port_id_t sender_port, step_t delay, object_type_t recv_type, engineid_t rec_engine, local_objectid_t rec_oid, int port );

Definition at line 199 of file MultiThreadNetwork.h.

References MTAnalogMessageCreator::addAnalogMessage(), SimParameter::dt, SimObject::ID::eng, Time::in_ms(), Time::in_steps(), SimParameter::maxDelay, SimParameter::minDelay, mtAnalogMsgCreator, SimNetwork::simParam, and stAnalogMsgCreators.

Referenced by _addAnalogMessage_().

Here is the call graph for this function:

void MultiThreadNetwork::seed_noise_rng ( uint32  noise_seed  )  [protected, virtual]


Friends And Related Function Documentation

friend class DistributedSingleThreadNetwork [friend]

Definition at line 116 of file MultiThreadNetwork.h.

friend class DistributedMultiThreadNetwork [friend]

Definition at line 117 of file MultiThreadNetwork.h.


Member Data Documentation

Number of threads the network utilizes to perform simulation.

Definition at line 229 of file MultiThreadNetwork.h.

Tables used for spike routing in the multi-threaded spike exchange case.

Definition at line 232 of file MultiThreadNetwork.h.

Referenced by _addSpikeMessage_(), and ~MultiThreadNetwork().

ThreadPool holding thread objects used in multi-thread processing.

Definition at line 235 of file MultiThreadNetwork.h.

Array of Propagated spike buffers, one for each SingleThreadSimEngine.

Definition at line 238 of file MultiThreadNetwork.h.

Referenced by ~MultiThreadNetwork().

Spike scheduler used for scheduling the spikes to appropriate propagated spike buffers.

Definition at line 241 of file MultiThreadNetwork.h.

Referenced by _reset_(), and ~MultiThreadNetwork().

Engine which runs the simulation in multiple threads, advances sim objects and controls the spike scheduler.

Uses multiple SingleThreadSimEngine objects for advancing the sim objects, each running concurrently in a separate thread.

Definition at line 247 of file MultiThreadNetwork.h.

Referenced by _addObject_(), _addSpikeMessage_(), _advance_(), _connect_(), _getObject_(), _initialize_(), _insert_(), _mount_(), _reset_(), seed_noise_rng(), and ~MultiThreadNetwork().

Definition at line 249 of file MultiThreadNetwork.h.

Referenced by _initialize_(), _reset_(), and ~MultiThreadNetwork().

Definition at line 251 of file MultiThreadNetwork.h.

Referenced by addGenericAnalogMessage(), and ~MultiThreadNetwork().

Definition at line 253 of file MultiThreadNetwork.h.

Referenced by addGenericAnalogMessage(), and ~MultiThreadNetwork().

Definition at line 255 of file MultiThreadNetwork.h.

Referenced by ~MultiThreadNetwork().


The documentation for this class was generated from the following files:

Generated on Wed Jul 9 16:34:52 2008 for PCSIM by  doxygen 1.5.5