Skip to content

Commit e1740f2

Browse files
author
Divya Kamath
committed
Moved the function to Core class
1 parent ea773d4 commit e1740f2

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

Simulator/Core/Core.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ int Core::runSimulation(string executableName, string cmdLineArguments)
190190
}
191191
}
192192

193+
// Helper function for recorder to register spike history variables for all neurons.
194+
simulator.getModel().getLayout().getVertices().registerHistoryVariables();
195+
193196
// Run simulation
194197
LOG4CPLUS_TRACE(consoleLogger, "Starting Simulation");
195198
simulator.simulate();

Simulator/Vertices/AllVertices.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ class AllVertices {
8080
/// summation points to their Vm and resets the summation points to zero
8181
vector<BGFLOAT> summationPoints_;
8282

83+
/// Helper function for recorder to register spike history variables for all neurons.
84+
/// Option 1: Register neuron information in vertexEvents_ one by one.
85+
/// Option 2: Register a vector of EventBuffer variables.
86+
virtual void registerHistoryVariables() = 0;
87+
8388
/// Cereal serialization method
8489
template <class Archive> void serialize(Archive &archive, std::uint32_t const version);
8590

Simulator/Vertices/NG911/All911Vertices.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ class All911Vertices : public AllVertices {
120120
/// endStep (exclusive)
121121
virtual void loadEpochInputs(uint64_t currentStep, uint64_t endStep) override;
122122

123+
/// unused virtual function placeholder
124+
virtual void registerHistoryVariables() override {};
125+
123126
/// Accessor for the waiting queue of a vertex
124127
///
125128
/// @param vIdx The index of the vertex

Simulator/Vertices/Neuro/AllSpikingNeurons.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ void AllSpikingNeurons::setupVertices()
2020

2121
hasFired_.assign(size_, false);
2222
vertexEvents_.assign(size_, maxSpikes);
23-
24-
// Register spike history variables
25-
registerSpikeHistoryVariables();
2623
}
2724

2825
/// Register spike history variables for all neurons.
2926
/// Option 1: Register neuron information in vertexEvents_ one by one.
3027
/// Option 2: Register a vector of EventBuffer variables.
31-
void AllSpikingNeurons::registerSpikeHistoryVariables()
28+
void AllSpikingNeurons::registerHistoryVariables()
3229
{
3330
Recorder &recorder = Simulator::getInstance().getModel().getRecorder();
3431
string baseName = "Neuron_";

Simulator/Vertices/Neuro/AllSpikingNeurons.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ class AllSpikingNeurons : public AllVertices {
4747
/// Clear the spike counts out of all Neurons.
4848
void clearSpikeCounts();
4949

50+
/// Helper function for recorder to register spike history variables for all neurons.
51+
/// Option 1: Register neuron information in vertexEvents_ one by one.
52+
/// Option 2: Register a vector of EventBuffer variables.
53+
virtual void registerHistoryVariables() override;
54+
5055
/// Cereal serialization method
5156
template <class Archive> void serialize(Archive &archive);
5257

@@ -112,12 +117,6 @@ class AllSpikingNeurons : public AllVertices {
112117
/// True if back propagation is allowed.
113118
/// (parameters used for advanceVerticesDevice.)
114119
bool fAllowBackPropagation_;
115-
116-
/// helper for recorder register variables in setupVertices()
117-
/// Register spike history variables for all neurons.
118-
/// Option 1: Register neuron information in vertexEvents_ one by one.
119-
/// Option 2: Register a vector of EventBuffer variables.
120-
void registerSpikeHistoryVariables();
121120
};
122121

123122
// TODO: move this into EventBuffer.h. Well, hasFired_ and inherited members have to stay somehow.

0 commit comments

Comments
 (0)