Skip to content
Snippets Groups Projects
Unverified Commit 94f95bc9 authored by Nora Abi Akar's avatar Nora Abi Akar Committed by GitHub
Browse files

fix ubench compilation errors (#1828)

parent 10846cd4
No related branches found
No related tags found
No related merge requests found
......@@ -45,9 +45,8 @@ std::vector<pse_vector> generate_inputs(const std::vector<cell_gid_type>& gids,
for (std::size_t i=0; i<ncells*ev_per_cell; ++i) {
spike_event ev;
auto idx = gid_dist(gen);
auto gid = gids[idx];
auto t = 1.;
ev.target = {cell_gid_type(gid), cell_lid_type(0)};
ev.target = cell_lid_type(0);
ev.time = t;
ev.weight = 0;
input_events[idx].push_back(ev);
......
......@@ -22,8 +22,8 @@
using namespace arb;
std::vector<spike_event> generate_inputs(size_t ncells, size_t ev_per_cell) {
std::vector<spike_event> input_events;
std::vector<std::pair<cell_gid_type, spike_event>> generate_inputs(size_t ncells, size_t ev_per_cell) {
std::vector<std::pair<cell_gid_type, spike_event>> input_events;
std::default_random_engine engine;
std::uniform_int_distribution<cell_gid_type>(0u, ncells);
......@@ -38,53 +38,15 @@ std::vector<spike_event> generate_inputs(size_t ncells, size_t ev_per_cell) {
spike_event ev;
auto gid = gid_dist(gen);
auto t = time_dist(gen);
ev.target = {cell_gid_type(gid), cell_lid_type(0)};
ev.target = cell_lid_type(0);
ev.time = t;
ev.weight = 0;
input_events.push_back(ev);
input_events.emplace_back(gid, ev);
}
return input_events;
}
void single_queue(benchmark::State& state) {
using pev = spike_event;
const std::size_t ncells = state.range(0);
const std::size_t ev_per_cell = state.range(1);
// state
std::vector<pev> input_events = generate_inputs(ncells, ev_per_cell);
event_queue<pev> events;
while (state.KeepRunning()) {
// push events into a single queue
for (const auto& e: input_events) {
events.push(e);
}
// pop from queue to form single sorted vector
std::vector<pev> staged_events;
staged_events.reserve(events.size());
while (auto e = events.pop_if_before(1.f)) {
staged_events.push_back(*e);
}
// sort the staged events in order of target id
std::stable_sort(
staged_events.begin(), staged_events.end(),
[](const pev& l, const pev& r) {return l.target.gid<r.target.gid;});
// TODO: calculate the partition ranges. This overhead is not included in
// this benchmark, however this method is that much slower already, that
// illustrating this wouldn't change the conclusions.
// clobber contents of queue for next round of benchmark
events.clear();
benchmark::ClobberMemory();
}
}
void n_queue(benchmark::State& state) {
using pev = spike_event;
const std::size_t ncells = state.range(0);
......@@ -101,7 +63,7 @@ void n_queue(benchmark::State& state) {
// push events into the queue corresponding to target cell
for (const auto& e: input_events) {
event_lanes[e.target.gid].push(e);
event_lanes[e.first].push(e.second);
}
// pop from queue to form single sorted vector
......@@ -149,7 +111,7 @@ void n_vector(benchmark::State& state) {
// push events into a per-cell vectors (unsorted)
for (const auto& e: input_events) {
event_lanes[e.target.gid].push_back(e);
event_lanes[e.first].push_back(e.second);
}
// sort each per-cell queue and keep track of the subset of sorted
// events that are to be delivered in this interval.
......@@ -198,8 +160,6 @@ void run_custom_arguments(benchmark::internal::Benchmark* b) {
}
}
//BENCHMARK(run_original)->Apply(run_custom_arguments);
BENCHMARK(single_queue)->Apply(run_custom_arguments);
BENCHMARK(n_queue)->Apply(run_custom_arguments);
BENCHMARK(n_vector)->Apply(run_custom_arguments);
......
......@@ -37,7 +37,7 @@ void run_cv_geom(benchmark::State& state) {
auto ends = cv_policy_fixed_per_branch(ncv_per_branch).cv_boundary_points(c);
while (state.KeepRunning()) {
benchmark::DoNotOptimize(cv_geometry_from_ends(c, ends));
benchmark::DoNotOptimize(cv_geometry(c, ends));
}
}
......@@ -48,7 +48,7 @@ void run_cv_geom_every_segment(benchmark::State& state) {
auto ends = cv_policy_every_segment().cv_boundary_points(c);
while (state.KeepRunning()) {
benchmark::DoNotOptimize(cv_geometry_from_ends(c, ends));
benchmark::DoNotOptimize(cv_geometry(c, ends));
}
}
......@@ -61,7 +61,7 @@ void run_cv_geom_explicit(benchmark::State& state) {
auto ends = cv_policy_every_segment().cv_boundary_points(c);
auto ends2 = cv_policy_explicit(std::move(ends)).cv_boundary_points(c);
benchmark::DoNotOptimize(cv_geometry_from_ends(c, ends2));
benchmark::DoNotOptimize(cv_geometry(c, ends2));
}
}
......
......@@ -62,13 +62,13 @@ public:
tree.append(s1, {0,0,soma_radius+dend_length,dend_radius}, 3);
arb::decor decor;
decor.paint(arb::reg::tagged(1), "pas");
decor.paint(arb::reg::tagged(1), arb::density("pas"));
decor.set_default(arb::cv_policy_max_extent((dend_length+soma_radius*2)/num_comp_));
auto distribution = std::uniform_real_distribution<float>(0.f, 1.0f);
for(unsigned i = 0; i < num_synapse_; i++) {
auto gen = std::mt19937(i);
decor.place(arb::mlocation{0, distribution(gen)}, "expsyn");
decor.place(arb::mlocation{0, distribution(gen)}, arb::synapse("expsyn"), "syn");
}
return arb::cable_cell{arb::morphology(tree), {}, decor};
......@@ -109,7 +109,7 @@ public:
tree.append(s1, {0,0,soma_radius+dend_length,dend_radius}, 3);
arb::decor decor;
decor.paint(arb::reg::all(), "pas");
decor.paint(arb::reg::all(), arb::density("pas"));
decor.set_default(arb::cv_policy_max_extent((dend_length+soma_radius*2)/num_comp_));
return arb::cable_cell {arb::morphology(tree), {}, decor};
......@@ -152,7 +152,7 @@ public:
tree.append(s2, {dend_length,0 ,soma_radius+dend_length, dend_radius}, 3);
arb::decor decor;
decor.paint(arb::reg::all(), "pas");
decor.paint(arb::reg::all(), arb::density("pas"));
decor.set_default(arb::cv_policy_max_extent((dend_length*3+soma_radius*2)/num_comp_));
return arb::cable_cell{arb::morphology(tree), {}, decor};
......@@ -193,7 +193,7 @@ public:
tree.append(s1, {0 ,0 ,soma_radius+dend_length, dend_radius}, 3);
arb::decor decor;
decor.paint(arb::reg::all(), "hh");
decor.paint(arb::reg::all(), arb::density("hh"));
decor.set_default(arb::cv_policy_max_extent((dend_length+soma_radius*2)/num_comp_));
return arb::cable_cell{arb::morphology(tree), {}, decor};
......@@ -236,7 +236,7 @@ public:
tree.append( s2, {dend_length,0 ,soma_radius+dend_length, dend_radius}, 3);
arb::decor decor;
decor.paint(arb::reg::all(), "hh");
decor.paint(arb::reg::all(), arb::density("hh"));
decor.set_default(arb::cv_policy_max_extent((dend_length*3+soma_radius*2)/num_comp_));
return arb::cable_cell{arb::morphology(tree), {}, decor};
......@@ -256,13 +256,8 @@ void expsyn_1_branch_current(benchmark::State& state) {
const unsigned nsynapse = state.range(1);
recipe_expsyn_1_branch rec_expsyn_1_branch(ncomp, nsynapse);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_expsyn_1_branch, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_expsyn_1_branch);
auto& m = find_mechanism("expsyn", cell);
......@@ -276,13 +271,8 @@ void expsyn_1_branch_state(benchmark::State& state) {
const unsigned nsynapse = state.range(1);
recipe_expsyn_1_branch rec_expsyn_1_branch(ncomp, nsynapse);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_expsyn_1_branch, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_expsyn_1_branch);
auto& m = find_mechanism("expsyn", cell);
......@@ -295,13 +285,8 @@ void pas_1_branch_current(benchmark::State& state) {
const unsigned ncomp = state.range(0);
recipe_pas_1_branch rec_pas_1_branch(ncomp);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_pas_1_branch, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_pas_1_branch);
auto& m = find_mechanism("pas", cell);
......@@ -314,13 +299,8 @@ void pas_3_branches_current(benchmark::State& state) {
const unsigned ncomp = state.range(0);
recipe_pas_3_branches rec_pas_3_branches(ncomp);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_pas_3_branches, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_pas_3_branches);
auto& m = find_mechanism("pas", cell);
......@@ -333,13 +313,8 @@ void hh_1_branch_state(benchmark::State& state) {
const unsigned ncomp = state.range(0);
recipe_hh_1_branch rec_hh_1_branch(ncomp);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_hh_1_branch, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_hh_1_branch);
auto& m = find_mechanism("hh", cell);
......@@ -352,13 +327,8 @@ void hh_1_branch_current(benchmark::State& state) {
const unsigned ncomp = state.range(0);
recipe_hh_1_branch rec_hh_1_branch(ncomp);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_hh_1_branch, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_hh_1_branch);
auto& m = find_mechanism("hh", cell);
......@@ -371,13 +341,8 @@ void hh_3_branches_state(benchmark::State& state) {
const unsigned ncomp = state.range(0);
recipe_hh_3_branches rec_hh_3_branches(ncomp);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_hh_3_branches, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_hh_3_branches);
auto& m = find_mechanism("hh", cell);
......@@ -390,13 +355,8 @@ void hh_3_branches_current(benchmark::State& state) {
const unsigned ncomp = state.range(0);
recipe_hh_3_branches rec_hh_3_branches(ncomp);
std::vector<cell_gid_type> gids = {0};
std::vector<target_handle> target_handles;
std::vector<fvm_index_type> cell_to_intdom;
probe_association_map probe_handles;
fvm_cell cell((execution_context()));
cell.initialize(gids, rec_hh_3_branches, cell_to_intdom, target_handles, probe_handles);
cell.initialize({0}, rec_hh_3_branches);
auto& m = find_mechanism("hh", cell);
......
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