Skip to content

Commit

Permalink
Remove an obsolete hierarchy.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenhater committed Jan 31, 2023
1 parent adbec3c commit 6273fc0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 35 deletions.
2 changes: 1 addition & 1 deletion arbor/communication/communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ void communicator::update_connections(const recipe& rec,
auto src_domain = src_domains.begin();
auto target_resolver = resolver(&target_resolution_map);
auto source_labels = std::unordered_map<cell_gid_type, std::unique_ptr<label_resolution_map>>{};
auto source_resolvers = std::unordered_map<cell_gid_type, resolver>{};
for (const auto& cell: gid_infos) {
auto index = cell.index_on_domain;
auto source_resolvers = std::unordered_map<cell_gid_type, resolver>{};
for (const auto& c: cell.conns) {
auto sgid = c.source.gid;
if (!source_labels.count(sgid)) {
Expand Down
11 changes: 11 additions & 0 deletions arbor/include/arbor/profile/profiler.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once

#include <sys/resource.h>
#include <iostream>

#include <cstdint>
#include <ostream>
#include <unordered_map>
Expand All @@ -13,6 +16,14 @@ namespace arb {

namespace profile {

inline
ARB_ARBOR_API void print_hwm_mem_at(const std::string& here,
const std::string& tag="") {
rusage usage;
getrusage(RUSAGE_SELF, &usage);
std::cout << "RSS:" << here << tag << ":" << usage.ru_maxrss << '\n';
}

// type used for region identifiers
using region_id_type = std::size_t;

Expand Down
43 changes: 9 additions & 34 deletions arbor/include/arbor/recipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,8 @@ struct gap_junction_connection {
peer(std::move(peer)), local(std::move(local)), weight(g) {}
};

struct ARB_ARBOR_API has_gap_junctions {
virtual std::vector<gap_junction_connection> gap_junctions_on(cell_gid_type) const {
return {};
}
virtual ~has_gap_junctions() {}
};

struct ARB_ARBOR_API has_synapses {
virtual std::vector<cell_connection> connections_on(cell_gid_type) const {
return {};
}
virtual ~has_synapses() {}
};

struct ARB_ARBOR_API has_probes {
virtual std::vector<probe_info> get_probes(cell_gid_type gid) const {
return {};
}
virtual ~has_probes() {}
};

struct ARB_ARBOR_API has_generators {
virtual std::vector<event_generator> event_generators(cell_gid_type) const {
return {};
}
virtual ~has_generators() {}
};

// Toppings allow updating a simulation
struct ARB_ARBOR_API connectivity: public has_synapses, has_generators {
virtual ~connectivity() {}
};

// Recipes allow building a simulation by lazy queries
struct ARB_ARBOR_API recipe: public has_gap_junctions, has_probes, connectivity {
struct ARB_ARBOR_API recipe {
// number of cells to build
virtual cell_size_type num_cells() const = 0;
// Cell description type will be specific to cell kind of cell with given gid.
Expand All @@ -104,6 +71,14 @@ struct ARB_ARBOR_API recipe: public has_gap_junctions, has_probes, connectivity
virtual cell_kind get_cell_kind(cell_gid_type) const = 0;
// Global property type will be specific to given cell kind.
virtual std::any get_global_properties(cell_kind) const { return std::any{}; };
// list of gap junctions incoming to this gid
virtual std::vector<gap_junction_connection> gap_junctions_on(cell_gid_type) const { return {}; }
// list of synapses incoming to this gid
virtual std::vector<cell_connection> connections_on(cell_gid_type) const { return {}; }
// list of probes on this gid
virtual std::vector<probe_info> get_probes(cell_gid_type gid) const { return {}; }
// list of generators on this gid
virtual std::vector<event_generator> event_generators(cell_gid_type) const { return {}; }

virtual ~recipe() {}
};
Expand Down
2 changes: 2 additions & 0 deletions arbor/simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ simulation_state::simulation_state(
task_system_(ctx->thread_pool),
local_spikes_({thread_private_spike_store(ctx->thread_pool),
thread_private_spike_store(ctx->thread_pool)}) {
profile::print_hwm_mem_at(__FUNCTION__, ":Start");
// Generate the cell groups in parallel, with one task per cell group.
auto num_groups = decomp.num_groups();
cell_groups_.resize(num_groups);
Expand All @@ -217,6 +218,7 @@ simulation_state::simulation_state(
communicator_ = communicator(rec, ddc_, *ctx_);
update(rec);
epoch_.reset();
profile::print_hwm_mem_at(__FUNCTION__, ":Stop");
}

void simulation_state::update(const recipe& rec) {
Expand Down

0 comments on commit 6273fc0

Please sign in to comment.