diff --git a/miniapp/miniapp_recipes.cpp b/miniapp/miniapp_recipes.cpp index f472f60c9d66e0157b17fedc7ae96feb024cd659..c7aefed259dd972247eae9a4c93ebf32d57bf396 100644 --- a/miniapp/miniapp_recipes.cpp +++ b/miniapp/miniapp_recipes.cpp @@ -112,7 +112,7 @@ protected: cell_gid_type ncell_; basic_recipe_param param_; probe_distribution pdist_; - static constexpr int basic_cell_segments = 3; + static constexpr int basic_cell_segments = 4; using exp_param = std::exponential_distribution<float>::param_type; exp_param delay_distribution_param; diff --git a/src/cell_group.hpp b/src/cell_group.hpp index 37e97d43376b44e5d795b2216eef7288351eac6f..f72d14b2d499ca31b2599c45470fe24a62b10859 100644 --- a/src/cell_group.hpp +++ b/src/cell_group.hpp @@ -64,11 +64,11 @@ public: PE("sampling"); while (auto m = sample_events_.pop_if_before(cell_time)) { - auto& sampler = samplers_[m->sampler_index]; - EXPECTS((bool)sampler.sample); + auto& sampler_spec = samplers_[m->sampler_index]; + EXPECTS((bool)sampler_spec.sampler); - index_type probe_index = sampler.probe_id.index; - auto next = sampler.sampler(cell_.time(), cell_.probe(probe_index)); + index_type probe_index = sampler_spec.probe_id.index; + auto next = sampler_spec.sampler(cell_.time(), cell_.probe(probe_index)); if (next) { m->time = std::max(*next, cell_time); sample_events_.push(*m); diff --git a/src/communication/communicator.hpp b/src/communication/communicator.hpp index 8f4e098743f80ca1becda71195c0212221e03f2b..42dfa845a61b96e9ec5a7bd616bd124124531fd2 100644 --- a/src/communication/communicator.hpp +++ b/src/communication/communicator.hpp @@ -50,7 +50,7 @@ public: void add_connection(connection con) { - EXPECTS(is_local_target(con.destination())); + EXPECTS(is_local_cell(con.destination().gid)); connections_.push_back(con); } @@ -114,11 +114,11 @@ public: // generate an event for each target for (auto it=targets.first; it!=targets.second; ++it) { auto gidx = it->destination().gid - cell_gid_from_; - events_[gidx].push_back(it->make_event(spike)); } } + //profiler_.leave(); // make events //profiler_.leave(); // event generation diff --git a/src/model.hpp b/src/model.hpp index 83ca129895571408d059ceb13fabb0c21b6206f8..252691fdbab57913a75ccfde1dcf19321752f7a3 100644 --- a/src/model.hpp +++ b/src/model.hpp @@ -34,7 +34,7 @@ struct model { cell_groups_ = std::vector<cell_group_type>{cell_to_-cell_from_}; threading::parallel_vector<probe_record> probes; - threading::parallel_for::apply(cell_from_, cell_to_, + threading::parallel_for::apply(cell_from_, cell_to_, [&](cell_gid_type i) { PE("setup", "cells"); auto cell = rec.get_cell(i); @@ -50,9 +50,19 @@ struct model { }); probes_.assign(probes.begin(), probes.end()); + communicator_ = communicator_type(cell_from_, cell_to_); + for (cell_gid_type i=cell_from_; i<cell_to_; ++i) { + for (const auto& cc: rec.connections_on(i)) { + // currently cell_connection and connection are basically the same data; + // merge? + communicator_.add_connection(connection{cc.source, cc.dest, cc.weight, cc.delay}); + } + } + communicator_.construct(); } + void reset() { t_ = 0.; for (auto& group: cell_groups_) {