Note

This is a developer feature for benchmarking, and is not useful for scientific use cases.

Dry-run Mode

Dry-run mode is used to mimic the performance of running an MPI distributed simulation without having access to an HPC cluster or even MPI support. It is verifiable against an MPI run with the same parameters. In dry-run mode, we describe the model on a single domain and translate it to however many domains we want to mimic. This allows us to know the exact behavior of the entire system by only running the simulation on a single node. To support dry-run mode we use the following classes:

class dry_run_context

Implements the arb::distributed_context interface for a fake distributed simulation.

unsigned num_ranks_

Number of domains we are mimicking.

unsigned num_cells_per_tile_

Number of cells assigned to each domain.

Constructor:

dry_run_context_impl(unsigned num_ranks, unsigned num_cells_per_tile)

Creates the dry run context and sets up the information needed to fake communication between domains.

Interface:

int id() const

Always 0. We are only performing the simulation on the local domain which will be root.

int size() const

Equal to num_ranks_.

std::string name() const

Returns "dry_run".

std::vector<std::string> gather(std::string value, int root) const

Duplicates the vector of strings from local domain, num_ranks_ times. Returns the concatenated vector.

gathered_vector<arb::spike> gather_spikes(const std::vector<arb::spike> &local_spikes) const

The vector of local_spikes represents the spikes obtained from running a simulation of num_cells_per_tile_ on the local domain. The returned vector should contain the spikes obtained from all domains in the dry-run. The spikes from the non-simulated domains are obtained by copying local_spikes and modifying the gids of each spike to refer to the corresponding gids on each domain. The obtained vectors of spikes from each domain are concatenated along with the original local_spikes and returned.

distributed_context_handle make_dry_run_context(unsigned num_ranks, unsigned num_cells_per_tile)

Convenience function that returns a handle to a dry_run_context.

class tile : public recipe

Note

While this class inherits from arb::recipe, it breaks one of its implicit rules: it allows connection from gids greater than the total number of cells in a recipe, ncells.

arb::tile describes the model on a single domain containing num_cells = num_cells_per_tile cells, which is to be duplicated over num_ranks() domains in dry-run mode. It contains information about num_ranks() which is provided by the following function:

cell_size_type num_tiles() const

Most of the overloaded functions in arb::tile describe a recipe on the local domain, as if it was the only domain in the simulation, except for the following two functions that accept gid arguments in the half open interval [0, num_cells*num_tiles):

std::vector<cell_connection> connections_on(cell_gid_type gid) const
std::vector<event_generator> event_generators(cell_gid_type gid) const
class symmetric_recipe : public recipe

A symmetric_recipe mimics having a model containing num_tiles() instances of arb::tile in a simulation of one tile per domain.

std::unique_ptr<tile> tiled_recipe_

symmetric_recipe owns a unique pointer to a arb::tile, and uses tiled_recipe_ to query information about the tiles on the local and mimicked domains.

Most functions in symmetric_recipe only need to call the underlying functions of tiled_recipe_ for the corresponding gid in the simulated domain. This is done with a simple modulo operation. For example:

cell_kind get_cell_kind(cell_gid_type i) const override {
    return tiled_recipe_->get_cell_kind(i % tiled_recipe_->num_cells());
}

The exception is again the following 2 functions:

std::vector<cell_connection> connections_on(cell_gid_type i) const

Calls

tiled_recipe_.connections_on(i % tiled_recipe_->num_cells())

But the obtained connections have to be translated to refer to the correct gids corresponding to the correct domain.

std::vector<event_generator> event_generators(cell_gid_type i) const

Calls

tiled_recipe_.event_generators(i)

Calls on the domain gid without the modulo operation, because the function has a knowledge of the entire network.