00001 #ifndef MTDISTRIBUTEDINCOMINGSPIKESCHEDULER_H_ 00002 #define MTDISTRIBUTEDINCOMINGSPIKESCHEDULER_H_ 00003 00004 #include "ThreadPool.h" 00005 #include "GlobalMultiTargetDelayMap.h" 00006 #include "STDistributedIncomingSpikeScheduler.h" 00007 00009 00013 class IncomingSpikeSchedulerThreadPoolJob : public ThreadPoolJob 00014 { 00015 public: 00016 IncomingSpikeSchedulerThreadPoolJob(STDistributedIncomingSpikeScheduler 00017 *incomingSpikeScheduler) 00018 : _incomingSpikeScheduler(incomingSpikeScheduler) 00019 {} 00020 00021 virtual void start() 00022 { 00023 _incomingSpikeScheduler->processMPIInputSpikeBuffers(); 00024 } 00025 00026 protected: 00027 STDistributedIncomingSpikeScheduler * _incomingSpikeScheduler; 00028 }; 00029 00031 00039 class MTDistributedIncomingSpikeScheduler : public DistributedIncomingSpikeScheduler 00040 { 00041 public: 00042 00044 /* 00045 * Constructs an instance of MTDistributedIncomingSpikeScheduler. 00046 * 00047 * \param numThreads Number of threads that are to be utilized in the processing. 00048 * 00049 * \param inputBuffers Reference to an array of the MPI input buffers that are to be scaned for incoming spikes. 00050 * 00051 * \param globalDelayMap Reference to the global delay map which contains the delays and target groups for each spike source. 00052 * 00053 * \param spikeBuffer Destination buffer of the processing. For each incoming spike a set of target groups are inserted in the appropriate place with respect to the delay. 00054 * 00055 * \param cycleSteps Number of simulation steps in one simulation cycle (usualy equal to minimum synapse delay). 00056 */ 00057 MTDistributedIncomingSpikeScheduler(int numThreads, 00058 ThreadPool &threadPool, 00059 MPIInputBufferVector &inputBuffers, 00060 GlobalMultiTargetDelayMap &globalDelayMap, 00061 vector<PropagatedSpikeBuffer*> &spikeBuffers, 00062 int cycleSteps) ; 00063 00064 virtual ~MTDistributedIncomingSpikeScheduler(); 00065 00067 virtual void processMPIInputSpikeBuffers(); 00068 00069 protected: 00070 // 00071 int nThreads; 00072 00074 00077 ThreadPool &thr_pool; 00078 00080 vector<STDistributedIncomingSpikeScheduler*> incomingSpikeSchedulers; 00081 00083 00089 vector<IncomingSpikeSchedulerThreadPoolJob*> jobs; 00090 }; 00091 00092 #endif /*MTDISTRIBUTEDINCOMINGSPIKESCHEDULER_H_*/