Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -yq libboost-graph-dev
# configure and build Simulator
- name: configure
run: cmake ..
run: cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
- id: build
name: build
run: make -j
Expand Down
7 changes: 6 additions & 1 deletion Simulator/Connections/Neuro/ConnGrowth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,9 @@ void ConnGrowth::printRadii() const

void ConnGrowth::registerHistoryVariables()
{
}
Recorder &recorder = Simulator::getInstance().getModel().getRecorder();
recorder.registerVariable("radii", radii_, Recorder::UpdatedType::DYNAMIC);
recorder.registerVariable("rates", rates_, Recorder::UpdatedType::DYNAMIC);
recorder.registerVariable("outgrowth", outgrowth_, Recorder::UpdatedType::DYNAMIC);
recorder.registerVariable("deltaR", deltaR_, Recorder::UpdatedType::DYNAMIC);
}
22 changes: 21 additions & 1 deletion Simulator/Connections/Neuro/ConnStatic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,31 @@ void ConnStatic::printParameters() const
void ConnStatic::registerHistoryVariables()
{
// Register the following variables to be recorded
// Note: There may be potential duplicate weight, source, destination vertices
Recorder &recorder = Simulator::getInstance().getModel().getRecorder();
recorder.registerVariable("weight", WCurrentEpoch_, Recorder::UpdatedType::DYNAMIC);
recorder.registerVariable("sourceVertex", sourceVertexIndexCurrentEpoch_,
Recorder::UpdatedType::DYNAMIC);
recorder.registerVariable("destinationVertex", destVertexIndexCurrentEpoch_,
Recorder::UpdatedType::DYNAMIC);
}

bool ConnStatic::updateConnections()
{
AllEdges &edges = getEdges();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this a bit more and found that the GPU data is copied back after the recorder has already saved the values, so the recorded weights could be outdated.

I kept the local copy call reverted based on our earlier discussion. Should this be addressed before merging, or tracked separately?

const vector<unsigned char> &inUse = edges.getInUse();
const vector<BGFLOAT> &weights = edges.getWeights();
const vector<int> &sourceVertices = edges.getSourceVertexIndices();
const vector<int> &destVertices = edges.getDestVertexIndices();

// Copy one value per active edge into parallel recorder vectors.
// weight/source/destination entries at the same index describe the same edge.
for (BGSIZE iEdg = 0; iEdg < inUse.size(); iEdg++) {
if (inUse[iEdg]) {
WCurrentEpoch_.push_back(weights[iEdg]);
sourceVertexIndexCurrentEpoch_.push_back(sourceVertices[iEdg]);
destVertexIndexCurrentEpoch_.push_back(destVertices[iEdg]);
}
}

return false;
}
3 changes: 3 additions & 0 deletions Simulator/Connections/Neuro/ConnStatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class ConnStatic : public Connections {
/// Registers history variables for recording during simulation
virtual void registerHistoryVariables() override;

/// Populates edge history variables for recording during the current epoch.
virtual bool updateConnections() override;

/// Get array of vertex weights
const vector<BGFLOAT> &getWCurrentEpoch() const
{
Expand Down
26 changes: 25 additions & 1 deletion Simulator/Edges/AllEdges.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ class AllEdges {
/// Populate a edge index map.
virtual void createEdgeIndexMap(EdgeIndexMap &edgeIndexMap);

/// Get array of source vertex indices.
const vector<int> &getSourceVertexIndices() const
{
return sourceVertexIndex_;
}

/// Get array of destination vertex indices.
const vector<int> &getDestVertexIndices() const
{
return destVertexIndex_;
}

/// Get array of edge weights.
const vector<BGFLOAT> &getWeights() const
{
return W_;
}

/// Get array of active edge flags.
const vector<unsigned char> &getInUse() const
{
return inUse_;
}

/// Cereal serialization method
template <class Archive> void serialize(Archive &archive);

Expand Down Expand Up @@ -253,4 +277,4 @@ template <class Archive> void AllEdges::serialize(Archive &archive)
cereal::make_nvp("totalEdgeCount", totalEdgeCount_),
cereal::make_nvp("maxEdgesPerVertex", maxEdgesPerVertex_),
cereal::make_nvp("countVertices", countVertices_));
}
}
22 changes: 21 additions & 1 deletion Simulator/Layouts/NG911/Layout911.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,23 @@ void Layout911::setup()
// so we call its method first
Layout::setup();

// xloc_ and yloc_ remain the layout coordinate storage.
xloc_.assign(numVertices_, 0);
yloc_.assign(numVertices_, 0);

// Loop over all vertices and set their x and y locations
// Size recorder mirrors to one initialized value per vertex.
xlocRecorder_.assign(numVertices_, 0);
ylocRecorder_.assign(numVertices_, 0);

// Populate layout coordinates and recorder mirrors from GraphML.
GraphManager<NG911VertexProperties>::VertexIterator vi, vi_end;
GraphManager<NG911VertexProperties> &gm = GraphManager<NG911VertexProperties>::getInstance();
for (boost::tie(vi, vi_end) = gm.vertices(); vi != vi_end; ++vi) {
assert(*vi < numVertices_);
xloc_[*vi] = gm[*vi].x;
yloc_[*vi] = gm[*vi].y;
xlocRecorder_[*vi] = gm[*vi].x;
ylocRecorder_[*vi] = gm[*vi].y;
}

// Now we cache the between each pair of vertices distances^2 into a matrix
Expand All @@ -79,6 +86,19 @@ void Layout911::printParameters() const
{
}

void Layout911::registerHistoryVariables()
{
Layout::registerHistoryVariables();

// Register GraphML coordinates as CONSTANT recorder output.
Recorder &recorder = Simulator::getInstance().getModel().getRecorder();
string baseName = "Location";
string xLocation = "x_" + baseName;
string yLocation = "y_" + baseName;
recorder.registerVariable(xLocation, xlocRecorder_, Recorder::UpdatedType::CONSTANT);
recorder.registerVariable(yLocation, ylocRecorder_, Recorder::UpdatedType::CONSTANT);
}

// Creates a vertex type map.
void Layout911::generateVertexTypeMap()
{
Expand Down
11 changes: 9 additions & 2 deletions Simulator/Layouts/NG911/Layout911.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Layout911 : public Layout {
/// Registered to OperationManager as Operation::printParameters
virtual void printParameters() const override;

/// Registers history variables for recording during simulation.
virtual void registerHistoryVariables() override;

/// Creates a vertex type map.
///
/// @param numVertices number of the vertices to have in the type map.
Expand All @@ -91,6 +94,10 @@ class Layout911 : public Layout {
vector<int> psapVertexList_;
vector<int> responderVertexList_;

DeviceVector<BGFLOAT> xloc_;
DeviceVector<BGFLOAT> yloc_;
DeviceVector<BGFLOAT> xloc_; ///< Layout x coordinates.
DeviceVector<BGFLOAT> yloc_; ///< Layout y coordinates.

/// Recorder mirrors; DeviceVector cannot be registered directly.
RecordableVector<BGFLOAT> xlocRecorder_;
RecordableVector<BGFLOAT> ylocRecorder_;
};

Large diffs are not rendered by default.

380 changes: 196 additions & 184 deletions Testing/RegressionTesting/GoodOutput/Cpu/test-medium-connected-out.xml

Large diffs are not rendered by default.

380 changes: 196 additions & 184 deletions Testing/RegressionTesting/GoodOutput/Cpu/test-medium-long-out.xml

Large diffs are not rendered by default.

380 changes: 196 additions & 184 deletions Testing/RegressionTesting/GoodOutput/Cpu/test-medium-out.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,9 @@
<Matrix name="vertexTypeMap" type="complete" rows="1" columns="11" multiplier="1.0">
4 5 5 5 7 7 7 7 6 6 3
</Matrix>
<Matrix name="x_Location" type="complete" rows="1" columns="11" multiplier="1.0">
-122.329 -122.355 -122.38 -122.284 -122.335 -122.337 -122.317 -122.362 -122.309 -122.355 0
</Matrix>
<Matrix name="y_Location" type="complete" rows="1" columns="11" multiplier="1.0">
47.6043 47.6821 47.5608 47.6686 47.7029 47.6161 47.6152 47.536 47.5719 47.6821 0
</Matrix>

Large diffs are not rendered by default.

Loading
Loading