Skip to content

Commit

Permalink
Update for Arbor v0.5 (#106)
Browse files Browse the repository at this point in the history
* Modify validation sources for 0.5 decor API.
* Replace some tabs with eight spaces in scripts.
* Update Arbor branch for download, and in install docs.
* Minor comment fix in ring benchmark.
* Add #! for install-local.sh and run-bench.sh
  • Loading branch information
halfflat authored Jan 21, 2021
1 parent 2457b8b commit d2fd5b2
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 55 deletions.
2 changes: 1 addition & 1 deletion benchmarks/engines/busyring/arbor/ring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ arb::cable_cell branch_cell(arb::cell_gid_type gid, const cell_parameters& param
// Add spike threshold detector at the soma.
decor.place(arb::mlocation{0,0}, arb::threshold_detector{10});

// Add a synapse to the mid point of the first dendrite.
// Add a synapse to proximal end of first dendrite.
decor.place(arb::mlocation{1, 0}, "expsyn");

// Add additional synapses that will not be connected to anything.
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ There are Arbor-specific options for checking out Arbor from a Git repository, a
Variable Default value Explanation
======================== =========================================== ======================================================
``ns_arb_git_repo`` ``https://github.com/arbor-sim/arbor.git`` URL or directory for the Git repository to check out Arbor source from.
``ns_arb_branch`` ``v0.2`` The branch/tag/SHA to check out. Master will be used if empty.
``ns_arb_branch`` ``v0.5`` The branch/tag/SHA to check out. Master will be used if empty.
``ns_arb_arch`` ``native`` `The CPU architecture target <https://arbor.readthedocs.io/en/latest/install.html#architecture>`_
for Arbor. Must be set when cross compiling.
Default ``native`` targets the architecture used to configure NSuite.
Expand Down
24 changes: 13 additions & 11 deletions install-local.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

usage() {
cat <<'_end_'
Usage: install-local.sh [--pyvenv=VENVOPT] [--env=SCRIPT] [--prefix=PATH] TARGET [TARGET...]
Expand Down Expand Up @@ -64,11 +66,11 @@ do
;;
--pyvenv=* )
ns_pyvenv=${1#--pyvenv=}
;;
;;
--pyvenv )
shift
shift
ns_pyvenv=$1
;;
;;
--env=* )
ns_environment=${1#--env=}
;;
Expand Down Expand Up @@ -175,18 +177,18 @@ if [ "$ns_pyvenv" != disable ]; then
msghi "Initializing python virtual environment"
ns_pyvenv_opt=
if [ "$ns_pyvenv" == inherit ]; then
ns_pyvenv_opt=--system-site-packages
ns_pyvenv_opt=--system-site-packages
fi

msg "Installing python modules: $ns_pyvenv_modules"
(
exec >> "$ns_build_path/log_pyvenv" 2>&1
if "$ns_python" -m venv $ns_pyvenv_opt "$ns_pyvenv_path"; then
source "$ns_pyvenv_path/bin/activate"
for pkg in $ns_pyvenv_modules; do
pip install "$pkg"
done
fi
exec >> "$ns_build_path/log_pyvenv" 2>&1
if "$ns_python" -m venv $ns_pyvenv_opt "$ns_pyvenv_path"; then
source "$ns_pyvenv_path/bin/activate"
for pkg in $ns_pyvenv_modules; do
pip install "$pkg"
done
fi
)
fi

Expand Down
2 changes: 2 additions & 0 deletions run-bench.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

usage() {
cat <<_end_
Usage: run-bench.sh [OPTIONS] SIMULATOR
Expand Down
4 changes: 2 additions & 2 deletions scripts/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ default_environment() {
# Arbor specific

ns_arb_git_repo=https://github.com/arbor-sim/arbor.git
ns_arb_branch=v0.4
ns_arb_branch=v0.5

ns_arb_arch=native
ns_arb_gpu=none
Expand Down Expand Up @@ -175,7 +175,7 @@ save_environment() {
pyvenv_activate=$ns_pyvenv_path/bin/activate
source_pyvenv_script=
if [ -r "$pyvenv_activate" ]; then
source_pyvenv_script="source '$pyvenv_activate'"
source_pyvenv_script="source '$pyvenv_activate'"
fi

cat <<_end_ > "$ns_config_path/env_$sim.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,16 @@ struct rc_cable_recipe: public arb::recipe {
segment_tree tree;
tree.append(arb::mnpos, {0., 0., 0., d0/2}, {0., 0., length, d1/2}, 0);

cable_cell c(arb::morphology(tree), {});

c.default_parameters.discretization = cv_policy_fixed_per_branch(n);

mechanism_desc pas("pas");
pas["g"] = 1e-4/rm; // [S/cm^2]
pas["e"] = 0; // erev=0

c.paint(reg::all(), pas);
c.place(mlocation{0, 1.}, i_clamp{0, INFINITY, iinj});
return c;
decor D;
D.paint(reg::all(), pas);
D.place(mlocation{0, 1.}, i_clamp{0, INFINITY, iinj});
D.set_default(cv_policy_fixed_per_branch(n));

return cable_cell(tree, {}, D);
}

// time constant in [ms]
Expand Down
15 changes: 7 additions & 8 deletions validation/src/arbor-rallpack1/arbor-rallpack1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,24 @@ struct rc_rallpack1_recipe: public arb::recipe {
for (unsigned i = 0; i < num_probes(gid); ++i) {
arb::mlocation loc{0, i==0? x0: x1};
probes.push_back(cable_probe_membrane_voltage{loc});
}
}
return probes;
}

util::unique_any get_cell_description(cell_gid_type) const override {
segment_tree tree;
tree.append(arb::mnpos, {0., 0., 0., d/2}, {0., 0., length, d/2}, 0);

cable_cell c(arb::morphology(tree), {});

c.default_parameters.discretization = cv_policy_fixed_per_branch(n);

mechanism_desc pas("pas");
pas["g"] = 1e-4/rm; // [S/cm^2]
pas["e"] = (double)erev;

c.paint(reg::all(), pas);
c.place(mlocation{0, 0}, i_clamp{0, INFINITY, iinj});
return c;
decor D;
D.paint(reg::all(), pas);
D.place(mlocation{0, 0}, i_clamp{0, INFINITY, iinj});
D.set_default(cv_policy_fixed_per_branch(n));

return cable_cell(tree, {}, D);
}
};

Expand Down
21 changes: 8 additions & 13 deletions validation/src/arbor-rc-exp2syn-spike/arbor-rc-exp2syn-spike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ struct rc_exp2syn_spike_recipe: public arb::recipe {
// Computed values:
std::vector<double> delay; // delay[i] is connection delay from gid 0 to gid i

static mlocation soma_centre() {
return {0u, 0.5};
}

explicit rc_exp2syn_spike_recipe(const paramset& ps):
g0(ps.at("g0")), threshold(ps.at("threshold")),
mindelay(ps.at("mindelay")), ncell((int)ps.at("ncell"))
Expand Down Expand Up @@ -88,7 +84,7 @@ struct rc_exp2syn_spike_recipe: public arb::recipe {
}

std::vector<arb::probe_info> get_probes(cell_gid_type gid) const override {
return {cable_probe_membrane_voltage{soma_centre()}};
return {cable_probe_membrane_voltage{ls::named("midpoint")}};
}

std::vector<event_generator> event_generators(cell_gid_type gid) const override {
Expand Down Expand Up @@ -117,16 +113,15 @@ struct rc_exp2syn_spike_recipe: public arb::recipe {

label_dict labels;
labels.set("soma", reg::tagged(1));
labels.set("centre", soma_centre());

cable_cell c(morphology(tree), labels);
c.default_parameters.membrane_capacitance = cm*1e-9/area; // [F/m^2]
labels.set("midpoint", mlocation{0, 0.5});

c.paint("\"soma\"", pas);
c.place("\"centre\"", exp2syn);
c.place("\"centre\"", threshold_detector{threshold});
decor D;
D.set_default(membrane_capacitance{cm*1e-9/area}); // [F/m^2]
D.paint("\"soma\"", pas);
D.place("\"midpoint\"", exp2syn);
D.place("\"midpoint\"", threshold_detector{threshold});

return c;
return cable_cell(tree, labels, D);
}

std::vector<arb::cell_connection> connections_on(cell_gid_type gid) const override {
Expand Down
19 changes: 7 additions & 12 deletions validation/src/arbor-rc-expsyn/arbor-rc-expsyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ struct rc_expsyn_recipe: public arb::recipe {
// Customizable parameters:
double g0; // synaptic conductance at time 0 [µS]

static mlocation soma_centre() {
return mlocation{0u, 0.5};
}

explicit rc_expsyn_recipe(const paramset& ps): g0(ps.at("g0")) {}

cell_size_type num_cells() const override { return 1; }
Expand All @@ -63,7 +59,7 @@ struct rc_expsyn_recipe: public arb::recipe {
}

std::vector<arb::probe_info> get_probes(cell_gid_type gid) const override {
return {cable_probe_membrane_voltage{soma_centre()}};
return {cable_probe_membrane_voltage{ls::named("midpoint")}};
}

std::vector<event_generator> event_generators(cell_gid_type) const override {
Expand All @@ -89,15 +85,14 @@ struct rc_expsyn_recipe: public arb::recipe {

label_dict labels;
labels.set("soma", reg::tagged(1));
labels.set("centre", soma_centre());

cable_cell c(morphology(tree), labels);
c.default_parameters.membrane_capacitance = cm*1e-9/area; // [F/m^2]
labels.set("midpoint", mlocation{0, 0.5});

c.paint("\"soma\"", pas);
c.place("\"centre\"", expsyn);
decor D;
D.set_default(membrane_capacitance{cm*1e-9/area}); // [F/m^2]
D.paint("\"soma\"", pas);
D.place("\"midpoint\"", expsyn);

return c;
return cable_cell(tree, labels, D);
}
};

Expand Down

0 comments on commit d2fd5b2

Please sign in to comment.