Skip to content
Snippets Groups Projects
Commit b5cbd968 authored by Sam Yates's avatar Sam Yates
Browse files

Tell communicator about connections.

Turns out this helps when trying to deliver spikes.
parent f517ba56
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,7 @@ protected: ...@@ -112,7 +112,7 @@ protected:
cell_gid_type ncell_; cell_gid_type ncell_;
basic_recipe_param param_; basic_recipe_param param_;
probe_distribution pdist_; 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; using exp_param = std::exponential_distribution<float>::param_type;
exp_param delay_distribution_param; exp_param delay_distribution_param;
......
...@@ -64,11 +64,11 @@ public: ...@@ -64,11 +64,11 @@ public:
PE("sampling"); PE("sampling");
while (auto m = sample_events_.pop_if_before(cell_time)) { while (auto m = sample_events_.pop_if_before(cell_time)) {
auto& sampler = samplers_[m->sampler_index]; auto& sampler_spec = samplers_[m->sampler_index];
EXPECTS((bool)sampler.sample); EXPECTS((bool)sampler_spec.sampler);
index_type probe_index = sampler.probe_id.index; index_type probe_index = sampler_spec.probe_id.index;
auto next = sampler.sampler(cell_.time(), cell_.probe(probe_index)); auto next = sampler_spec.sampler(cell_.time(), cell_.probe(probe_index));
if (next) { if (next) {
m->time = std::max(*next, cell_time); m->time = std::max(*next, cell_time);
sample_events_.push(*m); sample_events_.push(*m);
......
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
void add_connection(connection con) { void add_connection(connection con) {
EXPECTS(is_local_target(con.destination())); EXPECTS(is_local_cell(con.destination().gid));
connections_.push_back(con); connections_.push_back(con);
} }
...@@ -114,11 +114,11 @@ public: ...@@ -114,11 +114,11 @@ public:
// generate an event for each target // generate an event for each target
for (auto it=targets.first; it!=targets.second; ++it) { for (auto it=targets.first; it!=targets.second; ++it) {
auto gidx = it->destination().gid - cell_gid_from_; auto gidx = it->destination().gid - cell_gid_from_;
events_[gidx].push_back(it->make_event(spike)); events_[gidx].push_back(it->make_event(spike));
} }
} }
//profiler_.leave(); // make events //profiler_.leave(); // make events
//profiler_.leave(); // event generation //profiler_.leave(); // event generation
......
...@@ -34,7 +34,7 @@ struct model { ...@@ -34,7 +34,7 @@ struct model {
cell_groups_ = std::vector<cell_group_type>{cell_to_-cell_from_}; cell_groups_ = std::vector<cell_group_type>{cell_to_-cell_from_};
threading::parallel_vector<probe_record> probes; 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) { [&](cell_gid_type i) {
PE("setup", "cells"); PE("setup", "cells");
auto cell = rec.get_cell(i); auto cell = rec.get_cell(i);
...@@ -50,9 +50,19 @@ struct model { ...@@ -50,9 +50,19 @@ struct model {
}); });
probes_.assign(probes.begin(), probes.end()); probes_.assign(probes.begin(), probes.end());
communicator_ = communicator_type(cell_from_, cell_to_); 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() { void reset() {
t_ = 0.; t_ = 0.;
for (auto& group: cell_groups_) { for (auto& group: cell_groups_) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment