Skip to content
Snippets Groups Projects
domdec.rst 6.48 KiB

Domain decomposition

The Python API for partitioning a model over distributed and local hardware is described here.

Load balancers

Load balancing generates a :class:`domain_decomposition` given an :class:`arbor.recipe` and a description of the hardware on which the model will run. Currently Arbor provides one load balancer, :func:`partition_load_balance`, and more will be added over time.

If the model is distributed with MPI, the partitioning algorithm for cells is distributed with MPI communication. The returned :class:`domain_decomposition` describes the cell groups on the local MPI rank.

Provide a hint on how the cell groups should be partitioned.

An example of a partition load balance with hints reads as follows:

import arbor

# Get a communication context (with 4 threads, no GPU)
context = arbor.context(threads=4, gpu_id=None)

# Initialise a recipe of user defined type my_recipe with 100 cells.
n_cells = 100
recipe = my_recipe(n_cells)

# The hints prefer the multicore backend, so the decomposition is expected
# to never have cell groups on the GPU, regardless of whether a GPU is
# available or not.
cable_hint                  = arb.partition_hint()
cable_hint.prefer_gpu       = False
cable_hint.cpu_group_size   = 3
spike_hint                  = arb.partition_hint()
spike_hint.prefer_gpu       = False
spike_hint.cpu_group_size   = 4
hints = dict([(arb.cell_kind.cable, cable_hint), (arb.cell_kind.spike_source, spike_hint)])

decomp = arb.partition_load_balance(recipe, context, hints)

Decomposition

As defined in :ref:`modeldomdec` a domain decomposition is a description of the distribution of the model over the available computational resources. Therefore, the following data structures are used to describe domain decompositions.

Enumeration used to indicate which hardware backend to execute a cell group on.

Note

Setting the GPU back end is only meaningful if the cell group type supports the GPU backend.

Describes a domain decomposition and is solely responsible for describing the distribution of cells across cell groups and domains. It holds cell group descriptions (:attr:`groups`) for cells assigned to the local domain, and a helper function (:func:`gid_domain`) used to look up which domain a cell has been assigned to. The :class:`domain_decomposition` object also has meta-data about the number of cells in the global model, and the number of domains over which the model is distributed.

Note

The domain decomposition represents a division of all of the cells in the model into non-overlapping sets, with one set of cells assigned to each domain.

Return the indexes of a set of cells of the same kind that are grouped together in a cell group in an :class:`arbor.simulation`.