#include <MPIOutputSpikeBuffer.h>
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 | |
T | 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< int > | timestamps |
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 > |
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.
Definition at line 31 of file MPIOutputSpikeBuffer.h.
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.
typedef vector<T>::const_iterator MPIOutputSpikeBuffer< T >::vector_iterator [protected] |
Definition at line 126 of file MPIOutputSpikeBuffer.h.
MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer | ( | vector< gl_engineid_t > & | engIDs | ) | [inline] |
Constructor.
It is protected because MPIOutputSpikeBuffers are created only inside MPIOutputSpikeBufferVector.
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.
MPIOutputSpikeBuffer< T >::~MPIOutputSpikeBuffer | ( | ) | [inline, virtual] |
Definition at line 242 of file MPIOutputSpikeBuffer.h.
void MPIOutputSpikeBuffer< T >::initialize | ( | void * | spikeBuffer, | |
size_t | spikeBufferSize | |||
) | [inline] |
Definition at line 234 of file MPIOutputSpikeBuffer.h.
References MPIOutputSpikeBuffer< T >::buf_size, and MPIOutputSpikeBuffer< T >::serialBuffer.
Referenced by MPIOutputBuffer::initialize().
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.
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().
int MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer | ( | size_t | currentBufferSize | ) | [inline] |
Serializes a part of the buffer in a flat array, to be send by an mpi command.
Definition at line 303 of file MPIOutputSpikeBuffer.h.
References MPIOutputSpikeBuffer< T >::_buffers, MPIOutputSpikeBuffer< T >::gl_engineids, MPIOutputSpikeBuffer< T >::guard_value, MPIOutputSpikeBuffer< T >::initSerialization(), MPIOutputSpikeBuffer< T >::isInit, MPIOutputSpikeBuffer< T >::nLocalEngines, MPIOutputSpikeBuffer< T >::s_curr_eng, MPIOutputSpikeBuffer< T >::s_curr_src_pos, MPIOutputSpikeBuffer< T >::s_curr_timestamp, MPIOutputSpikeBuffer< T >::s_src_end_pos, MPIOutputSpikeBuffer< T >::serialBuffer, and MPIOutputSpikeBuffer< T >::serializationFinished.
Referenced by MPIOutputBuffer::prepareNextBufferSlice().
int MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer | ( | ) | [inline] |
Definition at line 70 of file MPIOutputSpikeBuffer.h.
References MPIOutputSpikeBuffer< T >::buf_size.
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().
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.
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().
void MPIOutputSpikeBuffer< T >::initSerialization | ( | ) | [inline, protected] |
The method which does the initialization of the state variables needed to carry serialization.
Definition at line 268 of file MPIOutputSpikeBuffer.h.
References MPIOutputSpikeBuffer< T >::_buffers, MPIOutputSpikeBuffer< T >::guard_value, MPIOutputSpikeBuffer< T >::nLocalEngines, MPIOutputSpikeBuffer< T >::s_curr_eng, MPIOutputSpikeBuffer< T >::s_curr_src_pos, MPIOutputSpikeBuffer< T >::s_curr_timestamp, MPIOutputSpikeBuffer< T >::s_src_end_pos, and MPIOutputSpikeBuffer< T >::serializationFinished.
Referenced by MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().
friend class MPIOutputSpikeBufferVector< T > [friend] |
Definition at line 137 of file MPIOutputSpikeBuffer.h.
T MPIOutputSpikeBuffer< T >::guard_value |
guard/marker value used to separate segments in the serialized data.
Definition at line 52 of file MPIOutputSpikeBuffer.h.
Referenced by MPIOutputSpikeBuffer< T >::appendSpike(), MPIOutputSpikeBuffer< T >::initSerialization(), MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().
int MPIOutputSpikeBuffer< T >::nLocalEngines [protected] |
Number of local single thread engines.
Definition at line 88 of file MPIOutputSpikeBuffer.h.
Referenced by MPIOutputSpikeBuffer< T >::initSerialization(), MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer(), MPIOutputSpikeBuffer< T >::nextCycle(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
bool MPIOutputSpikeBuffer< T >::serializationFinished [protected] |
Flag which points out if the serialization process of the output buffer is done.
Definition at line 135 of file MPIOutputSpikeBuffer.h.
Referenced by MPIOutputSpikeBuffer< T >::hasNextSerializedMPIBuffer(), MPIOutputSpikeBuffer< T >::initSerialization(), MPIOutputSpikeBuffer< T >::MPIOutputSpikeBuffer(), and MPIOutputSpikeBuffer< T >::prepareNextSerializedMPIBuffer().