Skip to content
Snippets Groups Projects
  • Benjamin Cumming's avatar
    Opaque Public Context (#576) · d637c8bc
    Benjamin Cumming authored
    Make the execution context presented to users an opaque handle, moving all implementation of the gpu, thread and distributed contexts into the back end.
    
    * move `execution_context` and `distributed_context` definitions to the back end
    * create `execution_context` handle called `context` in the public API
    * provide `make_context` helper functions that build different context configurations (default, user-specified local resources, with MPI)
    * update documentation for all parts of the public API that touch contexts
    * move `distributed_context` docs to the developer documentation (from the public API docs)
    Unverified
    d637c8bc
cpp_simulation.rst 5.05 KiB

Simulations

From recipe to simulation

To build a simulation the following are needed:

  • An :cpp:class:`arb::recipe` that describes the cells and connections in the model.
  • An :cpp:class:`arb::context` used to execute the simulation.

The workflow to build a simulation is to first generate a :cpp:class:`arb::domain_decomposition` that describes the distribution of the model over the local and distributed hardware resources (see :ref:`cppdomdec`), then build the simulation.

#include <arbor/context.hpp>
#include <arbor/domain_decomposition.hpp>
#include <arbor/simulation.hpp>

// Get a communication context
arb::context context = make_context();

// Make a recipe of user defined type my_recipe.
my_recipe recipe;

// Get a description of the partition the model over the cores
// (and gpu if available) on node.
arb::domain_decomposition decomp = arb::partition_load_balance(recipe, context);

// Instatitate the simulation.
arb::simulation sim(recipe, decomp, context);

Class Documentation