MPIOutputSpikeBuffer< T > Class Template Reference

Buffer holding the outgoing spikes to be dispatched to some other node in the next simulation cycle via MPI. More...

#include <MPIOutputSpikeBuffer.h>

Collaboration diagram for MPIOutputSpikeBuffer< T >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef T coding_element_type
 Type of the elements in the serialized spike data prepared for MPI transfer.

Public Member Functions

 MPIOutputSpikeBuffer (vector< gl_engineid_t > &engIDs)
 Constructor.
virtual ~MPIOutputSpikeBuffer ()
void initialize (void *spikeBuffer, size_t spikeBufferSize)
void appendSpike (local_objectid_t oid, int timestamp, engineid_t eng=0)
 Informs about a new occured spike that has to be communicated to some other node.
void nextCycle ()
 Reinitalizes the state of the buffer for the next cycle of simulation.
int prepareNextSerializedMPIBuffer (size_t currentBufferSize)
 Serializes a part of the buffer in a flat array, to be send by an mpi command.
int prepareNextSerializedMPIBuffer ()
bool hasNextSerializedMPIBuffer ()
 Tells if there are more parts left of the buffer to be serialized.
const T *const getBuffer ()
 Gets the pointer of serialized spike data to be communicated by MPI.
void setFinishedFlag (bool flag)
 Puts an information in the serialized buffer data that this is the last buffer for this simulation cycle.

Public Attributes

guard_value
 guard/marker value used to separate segments in the serialized data.

Protected Types

typedef vector< T >::const_iterator vector_iterator

Protected Member Functions

void initSerialization ()
 The method which does the initialization of the state variables needed to carry serialization.

Protected Attributes

int nLocalEngines
 Number of local single thread engines.
size_t buf_size
 The buffer size to hold the serialized spike data. Determines the maximum MPI message size.
vector< vector< T > > _buffers
 The vector buffers where the spikes are appended during simulation.
vector< gl_engineid_t > * gl_engineids
 Array holding the global engine ids for the local single thread engines. Needed because the mpi buffers work with global engine ids.
T * serialBuffer
 Serialized buffer where the serialized spike data is put during preparation for sending via MPI.
vector< inttimestamps
 The timestamp of the last stored spike originated from a particular single thread engine.
bool isInit
 Flag which says if the serialization process is initialized.
gl_engineid_t s_curr_eng
 Variable holding the id of the engine id which buffer is currently serialized.
int s_curr_timestamp
 Current timestamp of the serialization.
vector_iterator s_curr_src_pos
 Pointer to the current position in the buffer which is currently serialized.
vector_iterator s_src_end_pos
 The end position of the buffer which is currently serialized (i.e. _buffers[s_curr_eng].
bool serializationFinished
 Flag which points out if the serialization process of the output buffer is done.

Friends

class MPIOutputSpikeBufferVector< T >


Detailed Description

template<typename T = unsigned short>
class MPIOutputSpikeBuffer< T >

Buffer holding the outgoing spikes to be dispatched to some other node in the next simulation cycle via MPI.

It provides serialization facilities of the spikes which are appended to the buffer, so as to be easily communicated via MPI.

The buffers are created in an array by MPIOutputSpikeBufferVector, and cannot be created alone.

See also:
MPIInputSpikeBufferVector, MPIInputSpikeBuffer, MPIAllToAllCommunicator

Definition at line 31 of file MPIOutputSpikeBuffer.h.


Member Typedef Documentation

template<typename T = unsigned short>
typedef T MPIOutputSpikeBuffer< T >::coding_element_type

Type of the elements in the serialized spike data prepared for MPI transfer.

Can be short int or long int

Definition at line 49 of file MPIOutputSpikeBuffer.h.

template<typename T = unsigned short>
typedef vector<T>::const_iterator MPIOutputSpikeBuffer< T >::vector_iterator [protected]

Definition at line 126 of file MPIOutputSpikeBuffer.h.


Constructor & Destructor Documentation

template<typename T>
MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer ( vector< gl_engineid_t > &  engIDs  )  [inline]

Constructor.

It is protected because MPIOutputSpikeBuffers are created only inside MPIOutputSpikeBufferVector.

Parameters:
engIDs array giving the global engine ids of local single thread engines.
buffer_size size of the buffer memory block which is used to store the serialized spike data to send via MPI.

Definition at line 215 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::_buffers, MPIOutputSpikeBuffer< T >::gl_engineids, MPIOutputSpikeBuffer< T >::guard_value, MPIOutputSpikeBuffer< T >::nLocalEngines, MPIOutputSpikeBuffer< T >::serializationFinished, and MPIOutputSpikeBuffer< T >::timestamps.

template<typename T>
MPIOutputSpikeBuffer< T >::~MPIOutputSpikeBuffer (  )  [inline, virtual]

Definition at line 242 of file MPIOutputSpikeBuffer.h.


Member Function Documentation

template<typename T>
void MPIOutputSpikeBuffer< T >::initialize ( void *  spikeBuffer,
size_t  spikeBufferSize 
) [inline]

template<typename T>
void MPIOutputSpikeBuffer< T >::appendSpike ( local_objectid_t  oid,
int  timestamp,
engineid_t  eng = 0 
) [inline]

Informs about a new occured spike that has to be communicated to some other node.

Definition at line 246 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::_buffers, MPIOutputSpikeBuffer< T >::guard_value, and MPIOutputSpikeBuffer< T >::timestamps.

template<typename T>
void MPIOutputSpikeBuffer< T >::nextCycle (  )  [inline]

Reinitalizes the state of the buffer for the next cycle of simulation.

Definition at line 258 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::_buffers, MPIOutputSpikeBuffer< T >::isInit, MPIOutputSpikeBuffer< T >::nLocalEngines, and MPIOutputSpikeBuffer< T >::timestamps.

Referenced by MPIOutputBuffer::nextCycle().

template<typename T>
int MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer ( size_t  currentBufferSize  )  [inline]

template<typename T = unsigned short>
int MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer (  )  [inline]

Definition at line 70 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::buf_size.

template<typename T>
bool MPIOutputSpikeBuffer< T >::hasNextSerializedMPIBuffer (  )  [inline]

Tells if there are more parts left of the buffer to be serialized.

Definition at line 401 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::serializationFinished.

Referenced by MPIOutputBuffer::hasNextBufferSlice().

template<typename T>
const T *const MPIOutputSpikeBuffer< T >::getBuffer (  )  [inline]

Gets the pointer of serialized spike data to be communicated by MPI.

Definition at line 290 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::serialBuffer.

template<typename T>
void MPIOutputSpikeBuffer< T >::setFinishedFlag ( bool  flag  )  [inline]

Puts an information in the serialized buffer data that this is the last buffer for this simulation cycle.

Definition at line 296 of file MPIOutputSpikeBuffer.h.

References MPIOutputSpikeBuffer< T >::serialBuffer.

Referenced by MPIOutputBuffer::setFinishedFlag().

template<typename T>
void MPIOutputSpikeBuffer< T >::initSerialization (  )  [inline, protected]


Friends And Related Function Documentation

template<typename T = unsigned short>
friend class MPIOutputSpikeBufferVector< T > [friend]

Definition at line 137 of file MPIOutputSpikeBuffer.h.


Member Data Documentation

template<typename T = unsigned short>
T MPIOutputSpikeBuffer< T >::guard_value

template<typename T = unsigned short>
int MPIOutputSpikeBuffer< T >::nLocalEngines [protected]

template<typename T = unsigned short>
size_t MPIOutputSpikeBuffer< T >::buf_size [protected]

The buffer size to hold the serialized spike data. Determines the maximum MPI message size.

Definition at line 91 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::initialize(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
vector<vector<T> > MPIOutputSpikeBuffer< T >::_buffers [protected]

The vector buffers where the spikes are appended during simulation.

There is a separate buffer for storing the spikes originating from every local source engine. By concatenation of spike data in these buffers the serialized buffer stored in serialBuffer member is prepared.

Definition at line 98 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::appendSpike(), MPIOutputSpikeBuffer< T >::initSerialization(), MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer(), MPIOutputSpikeBuffer< T >::nextCycle(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
vector<gl_engineid_t>* MPIOutputSpikeBuffer< T >::gl_engineids [protected]

Array holding the global engine ids for the local single thread engines. Needed because the mpi buffers work with global engine ids.

Definition at line 101 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
T* MPIOutputSpikeBuffer< T >::serialBuffer [protected]

Serialized buffer where the serialized spike data is put during preparation for sending via MPI.

Definition at line 104 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::getBuffer(), MPIOutputSpikeBuffer< T >::initialize(), MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer(), and MPIOutputSpikeBuffer< T >::setFinishedFlag().

template<typename T = unsigned short>
vector<int> MPIOutputSpikeBuffer< T >::timestamps [protected]

The timestamp of the last stored spike originated from a particular single thread engine.

Needed to determine if a new timestamp segment should be started, if the timestamp of the current spike is bigger than the timestamp of the previous spike or the spike can be put in the same timestamp segment in the case of equal timesteps.

Definition at line 112 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::appendSpike(), MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer(), and MPIOutputSpikeBuffer< T >::nextCycle().

template<typename T = unsigned short>
bool MPIOutputSpikeBuffer< T >::isInit [protected]

Flag which says if the serialization process is initialized.

Definition at line 115 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::nextCycle(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
gl_engineid_t MPIOutputSpikeBuffer< T >::s_curr_eng [protected]

Variable holding the id of the engine id which buffer is currently serialized.

Definition at line 121 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::initSerialization(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
int MPIOutputSpikeBuffer< T >::s_curr_timestamp [protected]

Current timestamp of the serialization.

Definition at line 124 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::initSerialization(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
vector_iterator MPIOutputSpikeBuffer< T >::s_curr_src_pos [protected]

Pointer to the current position in the buffer which is currently serialized.

Definition at line 129 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::initSerialization(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
vector_iterator MPIOutputSpikeBuffer< T >::s_src_end_pos [protected]

The end position of the buffer which is currently serialized (i.e. _buffers[s_curr_eng].

Definition at line 132 of file MPIOutputSpikeBuffer.h.

Referenced by MPIOutputSpikeBuffer< T >::initSerialization(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().

template<typename T = unsigned short>
bool MPIOutputSpikeBuffer< T >::serializationFinished [protected]


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

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