00001 #ifndef DISTRIBUTEDMULTITHREADNETWORK_H_
00002 #define DISTRIBUTEDMULTITHREADNETWORK_H_
00003
00004 #include "DistributedNetwork.h"
00005 #include "DistributedSimEngine.h"
00006 #include "MultiThreadSimEngine.h"
00007 #include "MTDistributedIncomingSpikeScheduler.h"
00008 #include "DistributedSpikeScheduler.h"
00009 #include "MultiThreadSpikeScheduler.h"
00010 #include "GlobalMultiTargetDelayMap.h"
00011 #include "TargetNodesMap.h"
00012 #include "MPIInputBuffer.h"
00013 #include "MPIOutputBuffer.h"
00014 #include "MPIDefaultAllToAllCommunicator.h"
00015
00016 #ifndef __GCCXML__
00017
00018 #include "SingleThreadAnalogMsgDispatcher.h"
00019 #include "MultiThreadAnalogMsgDispatcher.h"
00020 #include "DistributedAnalogMessageDispatcher.h"
00021 #include "MTDistributedCycledAnalogMsgDispatcher.h"
00022 #include "STAnalogMessageCreator.h"
00023 #include "MTAnalogMessageCreator.h"
00024 #include "DistributedAnalogMessageCreator.h"
00025
00026 #endif
00027
00028
00030
00039 class DistributedMultiThreadNetwork : public DistributedNetwork {
00040 public:
00041
00043 DistributedMultiThreadNetwork(int numThreads, SimParameter sp = SimParameter::Default );
00044
00046
00054 DistributedMultiThreadNetwork(int numThreads, MPI::Intracomm &mpiCommunicator, SimParameter sp = SimParameter::Default );
00055
00056 virtual ~DistributedMultiThreadNetwork();
00057
00059
00060
00061 public:
00062 virtual void _addAnalogMessage_(const SimObject::ID &sender, int sender_port, const SimObject::ID &receiver, int recv_port, const Time &delay);
00063
00064 virtual void _addAnalogMessage_(const SimObject::ID &sender, int sender_port, const SimObject::ID &receiver, string destfield, const Time &delay);
00065
00066 virtual void _addAnalogMessage_(const SimObject::ID &sender, string srcfield, const SimObject::ID &receiver, int recv_port, const Time &delay);
00067
00068 virtual void _addAnalogMessage_(const SimObject::ID &sender, string srcfield, const SimObject::ID &receiver, string destfield, const Time &delay);
00069
00071 virtual gl_engineid_t maxLocalEngineID(void) const;
00072
00073 protected:
00074 template<typename analogSrcType, typename analogDestType>
00075 void addGenericAnalogMessage(const SimObject::ID &sender, analogSrcType srcPortOrField, const SimObject::ID &receiver, analogDestType destPortOrField, delay_t delay);
00076
00078
00079 protected:
00080
00082
00086 virtual void _reset_();
00087
00089
00096 virtual void _advance_(int nSteps = 1);
00097
00099 virtual void _initialize_();
00100
00102
00103 virtual SimObject *_getObject_(const SimObject::ID &id);
00105
00107 int nThreads;
00108
00110 MTDistributedIncomingSpikeScheduler *distIncomingSpikeScheduler;
00111
00113 DistributedSpikeScheduler *spikeScheduler;
00114
00116
00121 GlobalMultiTargetDelayMap *globalDelayMap;
00122
00124
00128 TargetNodesMap *targetNodesMap;
00129
00131 MPIAllToAllCommunicator *mpiAllToAllComm;
00132
00134
00137 MPIOutputBufferVector *mpiOutBuffers;
00138
00140
00143 MPIInputBufferVector *mpiInBuffers;
00144
00146 MTSpikeRoutingTables *mtTables;
00147
00149 ThreadPool thrPool;
00150
00152 vector<PropagatedSpikeBuffer*> STBuffers;
00153
00155
00158 MultiThreadSpikeScheduler *localSpikeScheduler;
00159
00160
00161
00162 #ifndef __GCCXML__
00163
00164 AnalogDelayObjectMap *analogDelayObjectsMap;
00165
00166 vector<MultiThreadAnalogMsgDispatcher *> mTanalogMsgDispatchers;
00167
00168 vector< DistributedAnalogMessageDispatcher *> distAnalogMsgDispatchers;
00169
00170 MTDistributedCycledAnalogMsgDispatcher *mtDistCycledAnalogMsgDispatcher;
00171
00172 vector< STAnalogMessageCreator * > stAnalogMsgCreators;
00173
00174 MTAnalogMessageCreator * mtAnalogMsgCreator;
00175
00176 vector< DistributedAnalogMessageCreator *> distAnalogMessageCreators;
00177
00178 vector<vector< DistributedIncomingAnalogMsgDispatcher *> > incomingDispatchers;
00179
00180 vector<DistIncomingAnalogSources2BufPosMap *> sources2BufPositionsMaps;
00181
00182 vector< vector< DistributedOutgoingAnalogMsgDispatcher *> > outgoingDispatchers;
00183
00184 #endif
00185
00186
00187
00189 void init();
00190
00191 protected:
00192
00193 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);
00194
00195 private:
00196 friend class NoiseRandomEngineTest;
00197 virtual void noiseRandEngineOutput( vector<uint32> & r );
00198
00199 };
00200
00201 #endif