#include <DistributedNetwork.h>
Public Member Functions | |
DistributedNetwork (int nThreads, SimParameter sp=SimParameter::Default) | |
Constructor setting the common attributes for simulation. | |
DistributedNetwork (int nThreads, MPI::Intracomm &mpiCommunicator, SimParameter sp=SimParameter::Default) | |
Constructor setting the common attributes for simulation. | |
virtual | ~DistributedNetwork () |
Destructor. | |
MPI::Intracomm & | getMpiComm () |
Return a reference of the MPI communicator in use. | |
virtual void | _addObject_ (const SimObjectFactory &objFactory, const SimEngine::ID &loc, SimObject::ID &gid) |
One instance of a simulation object is created by the factory and added at the specified simulation engine of the network. | |
virtual void | _addObject_ (const SimObjectFactory &objFactory, SimObject::ID &id) |
One instance of a simulation object is created and added to the network using the current distribution strategy. The SimObject::ID is returned. | |
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 a given delay. | |
Converting between local and global engine IDs | |
virtual gl_engineid_t | getGlobalEngineID (const SimEngine::ID &eid) const |
Return the global ID of a given SingleThreadSimEngine. | |
virtual gl_engineid_t | getGlobalEngineID (engineid_t eng) const |
Return the global ID of a given SingleThreadSimEngine on the executing MPI node. | |
virtual gl_engineid_t | maxGlobalEngineID (void) const |
Return the largest global simulation engine ID. | |
virtual gl_engineid_t | maxLocalEngineID (void) const |
Return the largest local simulation engine ID at the executing node. | |
virtual const SimEngine::ID | getLocation (gl_engineid_t gEID) const |
Return the reference to the location of a given global engine ID. | |
Protected Member Functions | |
virtual void | _mount_ (const SimObjectFactory &objFactory, const SimObject::ID &mountpoint, SimObject::ID &gid) |
One instance of a simulation object is created and "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::quadID of the newly created object is returned. | |
virtual void | _addSpikeMessage_ (const SimObject::ID &sender, const port_t out, const spike_port_id_t sender_port, const SimObject::ID &receiver, const port_t port, const step_t delay) |
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. | |
spike_port_id_t | getFirstSenderSpikePort (const SimObject::ID &oid) |
void | setupGlEngineIDs (unsigned int numLocalEngines=1) |
method that constructs the glengineids table | |
local_objectid_t | getGhostID (gl_engineid_t gEID, SimObjectFactory const &objFactory) |
virtual void | seed_noise_rng (uint32 noise_seed) |
virtual uint32 | getUniqueSeedOverMpi (uint32 seed) |
Protected Attributes | |
MPI::Intracomm & | mpi_comm |
mpi intra-communicator used for inter-node communication. | |
DistributedSimEngine * | distEngine |
pointer to the distributed sim engine the network uses for advancing the simulation. | |
SimEngine * | localSimEngine |
Engine which runs the local (sinlge-threaded) simulation, advances local objects and controls localSpikeScheduler. | |
vector< vector< gl_engineid_t > > | glengineids |
Table used to convert the local engine id for some node to global engine id. | |
vector< bool > | incomingConnections |
connectivity matrix saying if there are any object-object connections from one node to another. | |
vector< bool > | outgoingConnections |
gl_engineid_t | _max_global_engine_id |
Maximal global engine id. | |
vector< SimEngine::ID > | location |
Vector storing the location (i.e. node, local engie id) associated with a global engine ID. | |
vector< vector < local_objectid_t > > | objectCounter |
Count to be used to magically get the local object ID's of an object on an arbitrary node and thread. | |
vector< spike_port_id_t > | spikePortCounter |
Count to be used to magically get the first spike port ID of an object on an arbitrary node and thread. | |
vector< vector< vector < spike_port_id_t > > > | ghostFirstPortInfo |
Friends | |
class | DistributedMultiThreadNetworkTest |
Classes | |
struct | ConnectInfo |
All the network classes which implement distributed simulations should be derived from this class. It implements some functionalities that common to distributed simulations, like global engine ids setup, that can be used by derived classes.
Definition at line 23 of file DistributedNetwork.h.
DistributedNetwork::DistributedNetwork | ( | int | nThreads, | |
SimParameter | sp = SimParameter::Default | |||
) |
Constructor setting the common attributes for simulation.
Definition at line 18 of file DistributedNetwork.cpp.
References PCSIM::init().
DistributedNetwork::DistributedNetwork | ( | int | nThreads, | |
MPI::Intracomm & | mpiCommunicator, | |||
SimParameter | sp = SimParameter::Default | |||
) |
Constructor setting the common attributes for simulation.
Definition at line 24 of file DistributedNetwork.cpp.
References PCSIM::init().
DistributedNetwork::~DistributedNetwork | ( | ) | [virtual] |
MPI::Intracomm& DistributedNetwork::getMpiComm | ( | ) | [inline] |
Return a reference of the MPI communicator in use.
Definition at line 41 of file DistributedNetwork.h.
References mpi_comm.
void DistributedNetwork::_addObject_ | ( | const SimObjectFactory & | objFactory, | |
const SimEngine::ID & | loc, | |||
SimObject::ID & | gid | |||
) | [virtual] |
One instance of a simulation object is created by the factory and added at the specified simulation engine of the network.
loc | Specifies the node and local engine where the object should be added to. loc.engine is ignored! | |
id | The resulting unique identifier (node,engine,type,localid) of the created object. loc.engine = 0 always holds. |
Reimplemented from SimNetwork.
Definition at line 177 of file DistributedNetwork.cpp.
References SimEngine::addObject(), SimEngine::ID::engine, getGhostID(), getGlobalEngineID(), SimObjectFactory::getObjectTypeID(), SimObject::ID::Invalid, INVALID_GLOBAL_ENGINE_ID, localSimEngine, mpi_comm, SimEngine::ID::node, and SimEngine::ID::toString().
Referenced by _addObject_().
virtual void DistributedNetwork::_addObject_ | ( | const SimObjectFactory & | objFactory, | |
SimObject::ID & | id | |||
) | [inline, 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 52 of file DistributedNetwork.h.
References _addObject_(), and SimNetwork::distributionStrategy.
void DistributedNetwork::_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 a given delay.
Reimplemented from SimNetwork.
Definition at line 266 of file DistributedNetwork.cpp.
References SimNetwork::get_dt(), getFirstSenderSpikePort(), SimObjectRegistry::getObject(), Time::in_steps(), SimObject::spiking, theSimObjectRegistry, SimObject::ID::toString(), and SimObject::ID::type.
Referenced by _connect_().
gl_engineid_t DistributedNetwork::getGlobalEngineID | ( | const SimEngine::ID & | eid | ) | const [virtual] |
Return the global ID of a given SingleThreadSimEngine.
Definition at line 103 of file DistributedNetwork.cpp.
References SimEngine::ID::engine, glengineids, INVALID_GLOBAL_ENGINE_ID, and SimEngine::ID::node.
Referenced by _addObject_(), _insert_(), _mount_(), getFirstSenderSpikePort(), and getGlobalEngineID().
gl_engineid_t DistributedNetwork::getGlobalEngineID | ( | engineid_t | eng | ) | const [virtual] |
Return the global ID of a given SingleThreadSimEngine on the executing MPI node.
Definition at line 113 of file DistributedNetwork.cpp.
References getGlobalEngineID(), and mpi_comm.
gl_engineid_t DistributedNetwork::maxGlobalEngineID | ( | void | ) | const [virtual] |
Return the largest global simulation engine ID.
Definition at line 120 of file DistributedNetwork.cpp.
References _max_global_engine_id.
Referenced by DistributionStrategy::RankListStrategy::operator()(), DistributionStrategy::EngineListStrategy::operator()(), DistributionStrategy::RandomOverGlobalEngines::operator()(), DistributionStrategy::ModuloOverGlobalEngines::operator()(), and seed_noise_rng().
gl_engineid_t DistributedNetwork::maxLocalEngineID | ( | void | ) | const [virtual] |
Return the largest local simulation engine ID at the executing node.
Reimplemented from SimNetwork.
Reimplemented in DistributedMultiThreadNetwork.
Definition at line 125 of file DistributedNetwork.cpp.
Referenced by DistributionStrategy::RankListStrategy::operator()(), DistributionStrategy::RandomOverLocalEngines::operator()(), DistributionStrategy::ModuloOverLocalEnginesOnOneNode::operator()(), and DistributionStrategy::ModuloOverLocalEngines::operator()().
const SimEngine::ID DistributedNetwork::getLocation | ( | gl_engineid_t | gEID | ) | const [virtual] |
Return the reference to the location of a given global engine ID.
Definition at line 131 of file DistributedNetwork.cpp.
References SimEngine::ID::Invalid, and location.
Referenced by DistributionStrategy::RankListStrategy::operator()(), DistributionStrategy::EngineListStrategy::operator()(), DistributionStrategy::RandomOverGlobalEngines::operator()(), and DistributionStrategy::ModuloOverGlobalEngines::operator()().
void DistributedNetwork::_mount_ | ( | const SimObjectFactory & | model, | |
const SimObject::ID & | mountpoint, | |||
SimObject::ID & | gid | |||
) | [protected, virtual] |
One instance of a simulation object is created and "mounted" to the mount simulation object.
model | A model (factory) which specifis how the instance of the object to be added is created. | |
id | The resulting unique identifier (node,engine,type,localid) of the created object. |
Reimplemented from SimNetwork.
Definition at line 196 of file DistributedNetwork.cpp.
References SimObject::ID::eng, SimEngine::ID::engine, getGhostID(), getGlobalEngineID(), SimObjectFactory::getObjectTypeID(), SimObject::ID::Invalid, INVALID_GLOBAL_ENGINE_ID, localSimEngine, SimEngine::mount(), mpi_comm, SimEngine::ID::node, SimObject::ID::node, and SimObject::ID::toString().
void DistributedNetwork::_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::quadID of the newly created object is returned.
Reimplemented from SimNetwork.
Definition at line 215 of file DistributedNetwork.cpp.
References SimObject::ID::eng, SimEngine::ID::engine, getGhostID(), getGlobalEngineID(), SimObjectFactory::getObjectTypeID(), SimEngine::insert(), SimObject::ID::Invalid, INVALID_GLOBAL_ENGINE_ID, localSimEngine, mpi_comm, SimEngine::ID::node, SimObject::ID::node, and SimObject::ID::toString().
virtual void DistributedNetwork::_addSpikeMessage_ | ( | const SimObject::ID & | sender, | |
const port_t | out, | |||
const spike_port_id_t | sender_port, | |||
const SimObject::ID & | receiver, | |||
const port_t | port, | |||
const step_t | delay | |||
) | [inline, protected, virtual] |
Reimplemented in DistributedMultiThreadNetwork, and DistributedSingleThreadNetwork.
Definition at line 140 of file DistributedNetwork.h.
void DistributedNetwork::_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 236 of file DistributedNetwork.cpp.
References _addSpikeMessage_(), SimNetwork::addAnalogMessage(), SimObject::analog, SimNetwork::get_dt(), getFirstSenderSpikePort(), SimObject::getManagedDelay(), SimObjectRegistry::getObject(), SimEngine::getObject(), Time::in_sec(), localSimEngine, mpi_comm, SimObject::ID::node, SimObject::spiking, Time::steps(), theSimObjectRegistry, SimObject::ID::toString(), and SimObject::ID::type.
spike_port_id_t DistributedNetwork::getFirstSenderSpikePort | ( | const SimObject::ID & | oid | ) | [protected] |
Definition at line 294 of file DistributedNetwork.cpp.
References SimObject::ID::eng, getGlobalEngineID(), SimEngine::getObject(), SpikeSender::getSpikePort(), ghostFirstPortInfo, SpikeOutputPort::ID(), INVALID_SPIKE_PORT_ID, SimObject::ID::localid, localSimEngine, mpi_comm, SimObject::ID::node, and SimObject::ID::type.
Referenced by _addSpikeMessage_(), and _connect_().
void DistributedNetwork::setupGlEngineIDs | ( | unsigned int | numLocalEngines = 1 |
) | [protected] |
method that constructs the glengineids table
Definition at line 79 of file DistributedNetwork.cpp.
References _max_global_engine_id, glengineids, location, and mpi_comm.
local_objectid_t DistributedNetwork::getGhostID | ( | gl_engineid_t | gEID, | |
SimObjectFactory const & | objFactory | |||
) | [protected] |
Definition at line 140 of file DistributedNetwork.cpp.
References SimObjectRegistry::getObject(), SimObjectFactory::getObjectTypeID(), ghostFirstPortInfo, INVALID_LOCAL_OBJECT_ID, objectCounter, spikePortCounter, and theSimObjectRegistry.
Referenced by _addObject_(), _insert_(), and _mount_().
void DistributedNetwork::seed_noise_rng | ( | uint32 | noise_seed | ) | [protected, virtual] |
Reimplemented from SimNetwork.
Definition at line 59 of file DistributedNetwork.cpp.
References SimNetwork::_mpi_rank, SimParameter::constructionRNGSeed, SimNetwork::fillSeedVector(), getUniqueSeedOverMpi(), glengineids, localSimEngine, SimNetwork::makeSeed(), maxGlobalEngineID(), SimNetwork::mpi_rank(), SimNetwork::mpi_size(), SimNetwork::objectVariationRNDEngine, RandomEngine::seed(), SimEngine::seed(), SimNetwork::seed(), and SimNetwork::simParam.
Referenced by DistributedMultiThreadNetwork::init().
Reimplemented from SimNetwork.
Definition at line 52 of file DistributedNetwork.cpp.
References mpi_comm.
Referenced by seed_noise_rng().
friend class DistributedMultiThreadNetworkTest [friend] |
Definition at line 133 of file DistributedNetwork.h.
MPI::Intracomm& DistributedNetwork::mpi_comm [protected] |
mpi intra-communicator used for inter-node communication.
Definition at line 171 of file DistributedNetwork.h.
Referenced by _addObject_(), DistributedSingleThreadNetwork::_addSpikeMessage_(), DistributedMultiThreadNetwork::_addSpikeMessage_(), _connect_(), DistributedSingleThreadNetwork::_getObject_(), DistributedMultiThreadNetwork::_getObject_(), _insert_(), _mount_(), DistributedSingleThreadNetwork::addGenericAnalogMessage(), DistributedMultiThreadNetwork::addGenericAnalogMessage(), getFirstSenderSpikePort(), getGlobalEngineID(), getMpiComm(), getUniqueSeedOverMpi(), DistributedMultiThreadNetwork::init(), setupGlEngineIDs(), DistributedMultiThreadNetwork::~DistributedMultiThreadNetwork(), and DistributedSingleThreadNetwork::~DistributedSingleThreadNetwork().
DistributedSimEngine* DistributedNetwork::distEngine [protected] |
pointer to the distributed sim engine the network uses for advancing the simulation.
Definition at line 174 of file DistributedNetwork.h.
Referenced by DistributedSingleThreadNetwork::_advance_(), DistributedMultiThreadNetwork::_advance_(), DistributedSingleThreadNetwork::_reset_(), DistributedMultiThreadNetwork::_reset_(), DistributedMultiThreadNetwork::init(), DistributedMultiThreadNetwork::~DistributedMultiThreadNetwork(), and DistributedSingleThreadNetwork::~DistributedSingleThreadNetwork().
SimEngine* DistributedNetwork::localSimEngine [protected] |
Engine which runs the local (sinlge-threaded) simulation, advances local objects and controls localSpikeScheduler.
Used by (is a member of) DistributedSimEngine in this context.
Definition at line 180 of file DistributedNetwork.h.
Referenced by _addObject_(), DistributedSingleThreadNetwork::_addSpikeMessage_(), DistributedMultiThreadNetwork::_addSpikeMessage_(), _connect_(), DistributedSingleThreadNetwork::_getObject_(), DistributedMultiThreadNetwork::_getObject_(), DistributedSingleThreadNetwork::_initialize_(), DistributedMultiThreadNetwork::_initialize_(), _insert_(), _mount_(), getFirstSenderSpikePort(), DistributedMultiThreadNetwork::init(), seed_noise_rng(), DistributedMultiThreadNetwork::~DistributedMultiThreadNetwork(), and DistributedSingleThreadNetwork::~DistributedSingleThreadNetwork().
vector< vector< gl_engineid_t > > DistributedNetwork::glengineids [protected] |
Table used to convert the local engine id for some node to global engine id.
Definition at line 183 of file DistributedNetwork.h.
Referenced by DistributedSingleThreadNetwork::_addSpikeMessage_(), DistributedMultiThreadNetwork::_addSpikeMessage_(), getGlobalEngineID(), DistributedMultiThreadNetwork::init(), seed_noise_rng(), and setupGlEngineIDs().
vector<bool> DistributedNetwork::incomingConnections [protected] |
connectivity matrix saying if there are any object-object connections from one node to another.
Definition at line 186 of file DistributedNetwork.h.
Referenced by DistributedSingleThreadNetwork::_addSpikeMessage_(), DistributedMultiThreadNetwork::_addSpikeMessage_(), DistributedSingleThreadNetwork::addGenericAnalogMessage(), DistributedMultiThreadNetwork::addGenericAnalogMessage(), and DistributedMultiThreadNetwork::init().
vector<bool> DistributedNetwork::outgoingConnections [protected] |
Definition at line 187 of file DistributedNetwork.h.
Referenced by DistributedSingleThreadNetwork::_addSpikeMessage_(), DistributedMultiThreadNetwork::_addSpikeMessage_(), DistributedSingleThreadNetwork::addGenericAnalogMessage(), DistributedMultiThreadNetwork::addGenericAnalogMessage(), and DistributedMultiThreadNetwork::init().
Maximal global engine id.
Definition at line 196 of file DistributedNetwork.h.
Referenced by maxGlobalEngineID(), and setupGlEngineIDs().
vector< SimEngine::ID > DistributedNetwork::location [protected] |
Vector storing the location (i.e. node, local engie id) associated with a global engine ID.
Definition at line 199 of file DistributedNetwork.h.
Referenced by getLocation(), and setupGlEngineIDs().
vector< vector< local_objectid_t > > DistributedNetwork::objectCounter [protected] |
Count to be used to magically get the local object ID's of an object on an arbitrary node and thread.
Definition at line 205 of file DistributedNetwork.h.
Referenced by getGhostID().
vector< spike_port_id_t > DistributedNetwork::spikePortCounter [protected] |
Count to be used to magically get the first spike port ID of an object on an arbitrary node and thread.
Definition at line 208 of file DistributedNetwork.h.
Referenced by getGhostID().
vector< vector< vector< spike_port_id_t > > > DistributedNetwork::ghostFirstPortInfo [protected] |
Definition at line 210 of file DistributedNetwork.h.
Referenced by getFirstSenderSpikePort(), and getGhostID().