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

Update ubench benchmarks (#1453)

* fix mech_vec
* fix fvm_discretize
* small fixes
parent d6be1525
No related branches found
No related tags found
No related merge requests found
......@@ -557,7 +557,6 @@ installation comprises:
- The static libraries ``libarbor.a`` and ``libarborenv.a``.
- Public header files.
- The ``lmorpho`` l-system morphology generation utility
- The ``modcc`` NMODL compiler if built.
- The python module if built.
- The HTML documentation if built.
......
File moved
File moved
......@@ -7,8 +7,8 @@ set(bench_sources
default_construct.cpp
event_setup.cpp
event_binning.cpp
# fvm_discretize.cpp
# mech_vec.cpp
fvm_discretize.cpp
mech_vec.cpp
task_system.cpp
)
......@@ -25,9 +25,9 @@ foreach(bench_src ${bench_sources})
string(REGEX REPLACE "\\.[^.]*$" "" bench_exe ${bench_src})
add_executable(${bench_exe} EXCLUDE_FROM_ALL "${bench_src}")
target_link_libraries(${bench_exe} arbor arbor-private-headers ext-benchmark)
target_link_libraries(${bench_exe} arbor arborio arbor-private-headers ext-benchmark)
target_compile_options(${bench_exe} PRIVATE ${ARB_CXXOPT_ARCH})
target_compile_definitions(${bench_exe} PRIVATE "-DDATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/swc\"")
target_compile_definitions(${bench_exe} PRIVATE "-DDATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../swc\"")
list(APPEND bench_exe_list ${bench_exe})
endforeach()
......
......@@ -17,10 +17,8 @@
#define DATADIR "."
#endif
#define STRING(s) #s
#undef SWCFILE
#define SWCFILE STRING(DATADIR) "/motoneuron.swc"
#define SWCFILE DATADIR "/pyramidal.swc"
using namespace arb;
......@@ -71,35 +69,37 @@ void run_discretize(benchmark::State& state) {
auto gdflt = neuron_parameter_defaults;
const std::size_t ncv_per_branch = state.range(0);
cable_cell c(from_swc(SWCFILE));
c.default_parameters.discretization = cv_policy_fixed_per_branch(ncv_per_branch);
decor dec;
auto morpho = from_swc(SWCFILE);
dec.set_default(cv_policy_fixed_per_branch(ncv_per_branch));
while (state.KeepRunning()) {
benchmark::DoNotOptimize(fvm_cv_discretize(c, gdflt));
benchmark::DoNotOptimize(fvm_cv_discretize(cable_cell{morpho, {}, dec}, gdflt));
}
}
void run_discretize_every_segment(benchmark::State& state) {
auto gdflt = neuron_parameter_defaults;
cable_cell c(from_swc(SWCFILE));
c.default_parameters.discretization = cv_policy_every_segment();
decor dec;
auto morpho = from_swc(SWCFILE);
dec.set_default(cv_policy_every_segment());
while (state.KeepRunning()) {
benchmark::DoNotOptimize(fvm_cv_discretize(c, gdflt));
benchmark::DoNotOptimize(fvm_cv_discretize(cable_cell{morpho, {}, dec}, gdflt));
}
}
void run_discretize_explicit(benchmark::State& state) {
auto gdflt = neuron_parameter_defaults;
cable_cell c(from_swc(SWCFILE));
decor dec;
auto morpho = from_swc(SWCFILE);
auto ends = cv_policy_every_segment().cv_boundary_points(cable_cell{morpho});
dec.set_default(cv_policy_explicit(std::move(ends)));
while (state.KeepRunning()) {
auto ends = cv_policy_every_segment().cv_boundary_points(c);
c.default_parameters.discretization = cv_policy_explicit(std::move(ends));
benchmark::DoNotOptimize(fvm_cv_discretize(c, gdflt));
benchmark::DoNotOptimize(fvm_cv_discretize(cable_cell{morpho, {}, dec}, gdflt));
}
}
......
......@@ -57,25 +57,21 @@ public:
// Add soma.
auto s0 = tree.append(arb::mnpos, {0,0,-soma_radius,soma_radius}, {0,0,soma_radius,soma_radius}, 1);
// Add dendrite
auto s1 = tree.append(s0, {0,0,soma_radius,dend_radius}, 3);
tree.append(s1, {0,0,soma_radius+dend_length,dend_radius}, 3);
arb::label_dict d;
d.set("soma", arb::reg::tagged(1));
arb::cable_cell cell{arb::morphology(tree), d};
cell.paint("soma", "pas");
arb::decor decor;
decor.paint(arb::reg::tagged(1), "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);
cell.place(arb::mlocation{1, distribution(gen)}, "expsyn");
decor.place(arb::mlocation{0, distribution(gen)}, "expsyn");
}
cell.default_parameters = arb::neuron_parameter_defaults;
cell.default_parameters.discretization = arb::cv_policy_max_extent(dend_length/num_comp_);
return std::move(cell);
return arb::cable_cell{arb::morphology(tree), {}, decor};
}
virtual cell_kind get_cell_kind(cell_gid_type) const override {
......@@ -108,17 +104,15 @@ public:
// Add soma.
auto s0 = tree.append(arb::mnpos, {0,0,-soma_radius,soma_radius}, {0,0,soma_radius,soma_radius}, 1);
// Add dendrite
auto s1 = tree.append(s0, {0,0,soma_radius,dend_radius}, 3);
tree.append(s1, {0,0,soma_radius+dend_length,dend_radius}, 3);
arb::cable_cell cell{arb::morphology(tree)};
cell.paint(arb::reg::all(), "pas");
arb::decor decor;
decor.paint(arb::reg::all(), "pas");
decor.set_default(arb::cv_policy_max_extent((dend_length+soma_radius*2)/num_comp_));
cell.default_parameters = arb::neuron_parameter_defaults;
cell.default_parameters.discretization = arb::cv_policy_max_extent(dend_length/num_comp_);
return std::move(cell);
return arb::cable_cell {arb::morphology(tree), {}, decor};
}
virtual cell_kind get_cell_kind(cell_gid_type) const override {
......@@ -151,19 +145,17 @@ public:
// Add soma.
auto s0 = tree.append(arb::mnpos, {0,0,-soma_radius,soma_radius}, {0,0,soma_radius,soma_radius}, 1);
// Add dendrite
auto s1 = tree.append(s0, {0 ,0 ,soma_radius, dend_radius}, 3);
auto s2 = tree.append(s1, {0 ,0 ,soma_radius+dend_length, dend_radius}, 3);
tree.append(s2, {0 ,dend_length,soma_radius+dend_length, dend_radius}, 3);
tree.append(s2, {dend_length,0 ,soma_radius+dend_length, dend_radius}, 3);
arb::cable_cell cell{arb::morphology(tree)};
cell.paint(arb::reg::all(), "pas");
arb::decor decor;
decor.paint(arb::reg::all(), "pas");
decor.set_default(arb::cv_policy_max_extent((dend_length*3+soma_radius*2)/num_comp_));
cell.default_parameters = arb::neuron_parameter_defaults;
cell.default_parameters.discretization = arb::cv_policy_max_extent(dend_length*3/num_comp_);
return std::move(cell);
return arb::cable_cell{arb::morphology(tree), {}, decor};
}
virtual cell_kind get_cell_kind(cell_gid_type) const override {
......@@ -196,17 +188,15 @@ public:
// Add soma.
auto s0 = tree.append(arb::mnpos, {0,0,-soma_radius,soma_radius}, {0,0,soma_radius,soma_radius}, 1);
// Add dendrite
auto s1 = tree.append(s0, {0 ,0 ,soma_radius, dend_radius}, 3);
tree.append(s1, {0 ,0 ,soma_radius+dend_length, dend_radius}, 3);
arb::cable_cell cell{arb::morphology(tree)};
cell.paint(arb::reg::all(), "hh");
arb::decor decor;
decor.paint(arb::reg::all(), "hh");
decor.set_default(arb::cv_policy_max_extent((dend_length+soma_radius*2)/num_comp_));
cell.default_parameters = arb::neuron_parameter_defaults;
cell.default_parameters.discretization = arb::cv_policy_max_extent(dend_length/num_comp_);
return std::move(cell);
return arb::cable_cell{arb::morphology(tree), {}, decor};
}
virtual cell_kind get_cell_kind(cell_gid_type) const override {
......@@ -239,19 +229,17 @@ public:
// Add soma.
auto s0 = tree.append(arb::mnpos, {0,0,-soma_radius,soma_radius}, {0,0,soma_radius,soma_radius}, 1);
// Add dendrite
auto s1 = tree.append(s0, {0 ,0 ,soma_radius, dend_radius}, 3);
auto s2 = tree.append(s1, {0 ,0 ,soma_radius+dend_length, dend_radius}, 3);
tree.append( s2, {0 ,dend_length,soma_radius+dend_length, dend_radius}, 3);
tree.append( s2, {dend_length,0 ,soma_radius+dend_length, dend_radius}, 3);
arb::cable_cell cell{arb::morphology(tree)};
cell.paint(arb::reg::all(), "hh");
arb::decor decor;
decor.paint(arb::reg::all(), "hh");
decor.set_default(arb::cv_policy_max_extent((dend_length*3+soma_radius*2)/num_comp_));
cell.default_parameters = arb::neuron_parameter_defaults;
cell.default_parameters.discretization = arb::cv_policy_max_extent(dend_length*3/num_comp_);
return std::move(cell);
return arb::cable_cell{arb::morphology(tree), {}, decor};
}
virtual cell_kind get_cell_kind(cell_gid_type) const override {
......
This diff is collapsed.
......@@ -236,7 +236,7 @@ if(ARB_WITH_HIP_CLANG)
endif()
target_compile_options(unit PRIVATE ${ARB_CXXOPT_ARCH})
target_compile_definitions(unit PRIVATE "-DDATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/swc\"")
target_compile_definitions(unit PRIVATE "-DDATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../swc\"")
target_compile_definitions(unit PRIVATE "-DLIBDIR=\"${PROJECT_BINARY_DIR}/lib\"")
target_include_directories(unit PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
target_link_libraries(unit PRIVATE gtest arbor arborenv arborio arborio-private-headers arbor-private-headers arbor-sup)
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