Graphitti
A toolkit/software architecture to ease creating high-performance neural network simulators
|
Public Member Functions | |
EventBuffer (int maxEvents=0) | |
int | getNumElementsInEpoch () const |
virtual void | resize (int maxEvents) override |
uint64_t | operator[] (int i) const |
template<class Archive > | |
void | serialize (Archive &archive) |
Cereal serialization method. | |
Recorder Interface | |
virtual methods in RecordableBase for use by Recorder classes | |
virtual variantTypes | getElement (int index) const override |
Get the value of the recordable variable at the specified index. | |
virtual int | getNumElements () const override |
Get the number of elements that needs to be recorded. | |
virtual void | setDataType () override |
Return the runtime data type info of unit64_t. | |
virtual const string & | getDataType () const override |
Get the basic data type of the recordable variable. | |
virtual void | startNewEpoch () override |
Vertex and Edge Interface | |
EventBuffer interface for use by the Vertex and Edge classes | |
void | clear () |
void | insertEvent (uint64_t timeStep) |
uint64_t | getPastEvent (int offset) const |
![]() | |
RecordableVector () | |
Constructor. | |
uint64_t & | operator[] (int index) |
Overload the operator to set the value at a specific index. | |
const std::vector< uint64_t > & | getVector () const |
Method to retrieve the underlying std::vector<T> | |
void | serialize (Archive &archive) |
Cereal serialization method. | |
![]() | |
template<class Archive > | |
void | serialize (Archive &archive) |
Cereal serialization method. | |
Friends | |
class | AllIFNeurons |
class | AllSpikingNeurons |
Additional Inherited Members | |
![]() | |
RecordableBase ()=default | |
prevents any code outside this class from creating a RecordableBase object | |
![]() | |
vector< uint64_t > | dataSeries_ |
Holds the event time steps. | |
![]() | |
std::string | basicDataType_ |
the basic data type in the recorded variable | |
Definition at line 31 of file EventBuffer.h.
EventBuffer::EventBuffer | ( | int | maxEvents = 0 | ) |
Create EventBuffer that is sized appropriately
Create and size the buffer so that it can hold a set number of events. Once an EventBuffer is created with a nonzero size, it should not be resized (generally, doing that will cause a major bug in the simulator). Note that the buffer size will be set to maxEvents+1, to distinguish between an empty and a full buffer.
maxEvents | Defaults to zero; otherwise, buffer size is set |
Definition at line 16 of file EventBuffer.cpp.
void EventBuffer::clear | ( | ) |
Reset member variables consistent with an empty buffer
Definition at line 63 of file EventBuffer.cpp.
|
overridevirtual |
Get the basic data type of the recordable variable.
Reimplemented from RecordableVector< uint64_t >.
Definition at line 39 of file EventBuffer.cpp.
|
overridevirtual |
Get the value of the recordable variable at the specified index.
Set up a string representing the basic data type Get the value of the recordable variable at the specified index.
index | The index of the recorded value to retrieve. |
index | The index of the recorded value to retrieve. |
Reimplemented from RecordableVector< uint64_t >.
Definition at line 33 of file EventBuffer.cpp.
|
overridevirtual |
Get the number of elements that needs to be recorded.
Reimplemented from RecordableVector< uint64_t >.
Definition at line 49 of file EventBuffer.cpp.
int EventBuffer::getNumElementsInEpoch | ( | ) | const |
Get number of events in the current/preceding epoch
Getting the number of events in the current epoch (or, in between epochs, the number of events in the preceding epoch) is not the same as the number of events in the buffer, because the buffer retains events from the previous epoch, too.
Definition at line 44 of file EventBuffer.cpp.
uint64_t EventBuffer::getPastEvent | ( | int | offset | ) | const |
Get an event from a time in the past
Get the time step for an event in the past. An offset of -1 means the last event placed in the buffer; -2 means two events ago.
offset | How many events ago. Must be negative. If that event isn't in the buffer, or if the buffer is empty, returns ULONG_MAX. |
Definition at line 94 of file EventBuffer.cpp.
void EventBuffer::insertEvent | ( | uint64_t | timeStep | ) |
Insert an event time step
Insert an event time step into the buffer (i.e., enqueue it in the circular array implementation of the queue).
timeStep | Value to store in buffer |
Definition at line 83 of file EventBuffer.cpp.
uint64_t EventBuffer::operator[] | ( | int | i | ) | const |
Access event from current epoch
Access an element of the buffer as though it is an array or vector with element 0 being the first event in the epoch (element numElementsInEpoch_ - 1 would be the last element in the epoch).
i | element number |
Definition at line 71 of file EventBuffer.cpp.
|
overridevirtual |
Resize event buffer
Note that the buffer size will be set to maxEvents+1, to distinguish between an empty and a full buffer.
maxEvents | Buffer size |
Reimplemented from RecordableVector< uint64_t >.
Definition at line 54 of file EventBuffer.cpp.
void EventBuffer::serialize | ( | Archive & | archive | ) |
Cereal serialization method.
Definition at line 157 of file EventBuffer.h.
|
overridevirtual |
Return the runtime data type info of unit64_t.
Reimplemented from RecordableVector< uint64_t >.
Definition at line 25 of file EventBuffer.cpp.
|
overridevirtual |
Start a new epoch
Resets the internal variables associated with tracking the events in a epoch. Note that this doesn't affect the contents of the buffer; it just resets things so that the epoch start is the index of the next event to be enqueued and that the number of events in the epoch is 0.
Reimplemented from RecordableVector< uint64_t >.
Definition at line 76 of file EventBuffer.cpp.
|
friend |
Definition at line 32 of file EventBuffer.h.
|
friend |
Definition at line 33 of file EventBuffer.h.