Skip to content

Commit 481e1ce

Browse files
Merge PoseyDevelopment into SharedDevelopment (#814)
* [issue-745] Refactor where summation is calculated (#777) * Refactor model class to generalize the summation logic method and move implementation into neuron class * Implement new AllVertices method in 911 class * Fix last compile errors * Clean up commented out code * Resolve code format failure * Remove dynamic cast of vertices so model with work with non-neuron models * Add override keyword to integrateVertexInputs declaration * Fix formatting issue * [issue-785] Remove neuro items from gpu model (#789) * Rename edge index map device variable name * Rename method names to remove neuro context * Rename variables both in method signature and implementation * Fix formatting * Remove neuro from GPU model and generalize what we can * Remove summation point operation as it's now done in the neuro vertices base class * Revert formatting that breaks code style * Clean up comments, variable names, and includes * Move edge sum index into all spiking synapses and rename neuro GPU methods in both edges and vertices * Fix style violation * Make corresponding updates to documentation * Re add serialize method to documentation * Fix const representation * Add All911Edges to connections documentation * Update diagram images * Add small 911 test to RunTests (#804) Moved small 911 test into Cpu subfolder since it was generated with Cpu code. This required corresponding update to github actions. Then updated RunTests so that it would build the appropriate list of tests based on the current processing unit. * [issue-806] Implement integrateVertexInputs in All911Vertices (#807) * Implement integrateVertexInputs in All911Vertices Since advanceEdges doesn't update the edge state until after we know that we can transfer the call, we move all of the advanceEdges logic into integrateVertexInputs. * fix style issue
1 parent bb06edd commit 481e1ce

File tree

5 files changed

+78
-61
lines changed

5 files changed

+78
-61
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
run: ./cgraphitti -c ../Testing/RegressionTesting/configfiles/test-small-911.xml
7777
- name: verify test-small-911
7878
if: always() && steps.tt.conclusion == 'success'
79-
run: diff ../Testing/RegressionTesting/TestOutput/test-small-911-out.xml ../Testing/RegressionTesting/GoodOutput/test-small-911-out.xml
79+
run: diff ../Testing/RegressionTesting/TestOutput/test-small-911-out.xml ../Testing/RegressionTesting/GoodOutput/Cpu/test-small-911-out.xml
8080

8181
- id: tm
8282
name: run test-medium

Simulator/Edges/NG911/All911Edges.cpp

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -46,55 +46,7 @@ void All911Edges::createEdge(BGSIZE iEdg, int srcVertex, int destVertex, BGFLOAT
4646
/// Advance all the edges in the simulation.
4747
void All911Edges::advanceEdges(AllVertices &vertices, EdgeIndexMap &edgeIndexMap)
4848
{
49-
Simulator &simulator = Simulator::getInstance();
50-
All911Vertices &all911Vertices = dynamic_cast<All911Vertices &>(vertices);
51-
52-
for (int vertex = 0; vertex < simulator.getTotalVertices(); ++vertex) {
53-
int start = edgeIndexMap.incomingEdgeBegin_[vertex];
54-
int count = edgeIndexMap.incomingEdgeCount_[vertex];
55-
56-
if (simulator.getModel().getLayout().vertexTypeMap_[vertex] == vertexType::CALR) {
57-
continue; // TODO911: Caller Regions will have different behaviour
58-
}
59-
60-
// Loop over all the edges and pull the data in
61-
for (int eIdxMap = start; eIdxMap < start + count; ++eIdxMap) {
62-
int edgeIdx = edgeIndexMap.incomingEdgeIndexMap_[eIdxMap];
63-
64-
if (!inUse_[edgeIdx]) {
65-
continue;
66-
} // Edge isn't in use
67-
if (isAvailable_[edgeIdx]) {
68-
continue;
69-
} // Edge doesn't have a call
70-
71-
int dst = destVertexIndex_[edgeIdx];
72-
// The destination vertex should be the one pulling the information
73-
assert(dst == vertex);
74-
75-
CircularBuffer<Call> &dstQueue = all911Vertices.getQueue(dst);
76-
if (dstQueue.size() >= (dstQueue.capacity() - all911Vertices.busyServers(dst))) {
77-
// Call is dropped because there is no space in the waiting queue
78-
if (!isRedial_[edgeIdx]) {
79-
// Only count the dropped call if it's not a redial
80-
all911Vertices.droppedCalls(dst)++;
81-
// Record that we received a call
82-
all911Vertices.receivedCalls(dst)++;
83-
LOG4CPLUS_DEBUG(edgeLogger_,
84-
"Call dropped: " << all911Vertices.droppedCalls(dst) << ", time: "
85-
<< call_[edgeIdx].time << ", vertex: " << dst
86-
<< ", queue size: " << dstQueue.size());
87-
}
88-
} else {
89-
// Transfer call to destination
90-
dstQueue.put(call_[edgeIdx]);
91-
// Record that we received a call
92-
all911Vertices.receivedCalls(dst)++;
93-
isAvailable_[edgeIdx] = true;
94-
isRedial_[edgeIdx] = false;
95-
}
96-
}
97-
}
49+
// Edge properties are not updated until the vertex inputs are integrated into each vertex.
9850
}
9951

10052
/// Advance one specific edge.

Simulator/Vertices/NG911/All911Vertices.cpp

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,59 @@ int All911Vertices::busyServers(int vIdx) const
160160

161161
#if !defined(USE_GPU)
162162

163-
// Short description of the method.
163+
// Take calls from the edges and transfer them to the vertex if it's queue is not full
164164
void All911Vertices::integrateVertexInputs(AllEdges &edges, EdgeIndexMap &edgeIndexMap)
165165
{
166-
//TODO: Figure out where the appropriate logic is and move it here.
166+
Simulator &simulator = Simulator::getInstance();
167+
All911Edges &all911Edges = dynamic_cast<All911Edges &>(edges);
168+
169+
for (int vertex = 0; vertex < simulator.getTotalVertices(); ++vertex) {
170+
int start = edgeIndexMap.incomingEdgeBegin_[vertex];
171+
int count = edgeIndexMap.incomingEdgeCount_[vertex];
172+
173+
if (simulator.getModel().getLayout().vertexTypeMap_[vertex] == vertexType::CALR) {
174+
continue; // TODO911: Caller Regions will have different behaviour
175+
}
176+
177+
// Loop over all the edges and pull the data in
178+
for (int edge = start; edge < start + count; ++edge) {
179+
int edgeIdx = edgeIndexMap.incomingEdgeIndexMap_[edge];
180+
181+
if (!all911Edges.inUse_[edgeIdx]) {
182+
continue;
183+
} // Edge isn't in use
184+
if (all911Edges.isAvailable_[edgeIdx]) {
185+
continue;
186+
} // Edge doesn't have a call
187+
188+
int dst = all911Edges.destVertexIndex_[edgeIdx];
189+
// The destination vertex should be the one pulling the information
190+
assert(dst == vertex);
191+
192+
CircularBuffer<Call> &dstQueue = getQueue(dst);
193+
if (dstQueue.size() >= (dstQueue.capacity() - busyServers(dst))) {
194+
// Call is dropped because there is no space in the waiting queue
195+
if (!all911Edges.isRedial_[edgeIdx]) {
196+
// Only count the dropped call if it's not a redial
197+
droppedCalls(dst)++;
198+
// Record that we received a call
199+
receivedCalls(dst)++;
200+
LOG4CPLUS_DEBUG(vertexLogger_,
201+
"Call dropped: " << droppedCalls(dst)
202+
<< ", time: " << all911Edges.call_[edgeIdx].time
203+
<< ", vertex: " << dst
204+
<< ", queue size: " << dstQueue.size());
205+
}
206+
} else {
207+
// Transfer call to destination
208+
dstQueue.put(all911Edges.call_[edgeIdx]);
209+
// Record that we received a call
210+
receivedCalls(dst)++;
211+
all911Edges.isAvailable_[edgeIdx] = true;
212+
all911Edges.isRedial_[edgeIdx] = false;
213+
}
214+
}
215+
}
167216
}
168217

169218
// Update internal state of the indexed vertex (called by every simulation step).

Testing/RunTests.sh

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,31 @@ NC='\033[0m' # No color
5656
CONFIG_DIR=../Testing/RegressionTesting/configfiles
5757
TEST_OUT_DIR=../Testing/RegressionTesting/TestOutput
5858
GOOD_OUT_DIR=../Testing/RegressionTesting/GoodOutput/${PROCESSING_UNIT}
59-
declare -a TEST_FILES=("test-tiny"
60-
"test-small"
61-
"test-small-connected"
62-
"test-small-long"
63-
"test-small-connected-long"
64-
"test-medium"
65-
"test-medium-connected"
66-
"test-medium-long"
67-
"test-medium-connected-long")
59+
60+
# Get define the list of test files that we can run per processing unit
61+
# Lists are diffent when we have a CPU implementation of a model but no GPU implementation
62+
if [ $PROCESSING_UNIT == 'Cpu' ]; then
63+
declare -a TEST_FILES=("test-tiny"
64+
"test-small"
65+
"test-small-connected"
66+
"test-small-long"
67+
"test-small-connected-long"
68+
"test-medium"
69+
"test-medium-connected"
70+
"test-medium-long"
71+
"test-medium-connected-long"
72+
"test-small-911")
73+
else
74+
declare -a TEST_FILES=("test-tiny"
75+
"test-small"
76+
"test-small-connected"
77+
"test-small-long"
78+
"test-small-connected-long"
79+
"test-medium"
80+
"test-medium-connected"
81+
"test-medium-long"
82+
"test-medium-connected-long")
83+
fi
6884

6985
# This function starts the simulations in parallel
7086
function run_simulations() {

0 commit comments

Comments
 (0)