From 8566655c9a280c208dd3a9bc4bdfd3f1fa02c724 Mon Sep 17 00:00:00 2001
From: Ben Cumming <louncharf@gmail.com>
Date: Mon, 20 Nov 2017 09:53:10 +0100
Subject: [PATCH] Fix GPU event delivery bugs (#394)

* Properly iterate over all event queues in the case where a cell group has more than once cell (triggered in e.g. GPU miniapp).
* Update GPU unit test to use the new `cell_group::advance()` interface.
---
 src/model.cpp                    | 2 +-
 tests/unit/test_mc_cell_group.cu | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/model.cpp b/src/model.cpp
index de395019..0495cbda 100644
--- a/src/model.cpp
+++ b/src/model.cpp
@@ -115,7 +115,7 @@ time_type model::run(time_type tfinal, time_type dt) {
         PL();
 
         PE("enqueue");
-        threading::parallel_for::apply(0, num_groups(),
+        threading::parallel_for::apply(0, communicator_.num_local_cells(),
             [&](cell_size_type i) {
                 const auto epid = epoch_.id;
                 merge_events(
diff --git a/tests/unit/test_mc_cell_group.cu b/tests/unit/test_mc_cell_group.cu
index 2f0a8faf..8c5a2e11 100644
--- a/tests/unit/test_mc_cell_group.cu
+++ b/tests/unit/test_mc_cell_group.cu
@@ -26,7 +26,7 @@ TEST(mc_cell_group, test)
 {
     mc_cell_group<fvm_cell> group({0u}, cable1d_recipe(make_cell()));
 
-    group.advance(epoch(0, 50), 0.01);
+    group.advance(epoch(0, 50), 0.01, {});
 
     // the model is expected to generate 4 spikes as a result of the
     // fixed stimulus over 50 ms
-- 
GitLab