|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Parallel synchronous engine for cellular automata (Phase 5). More...
#include <array>#include <concepts>#include <cstddef>#include <functional>#include <future>#include <span>#include <thread>#include <type_traits>#include <utility>#include <vector>#include <thread_pool.H>#include <ca-tiling.H>#include <ca-traits.H>#include <tpl_ca_bit_storage.H>#include <tpl_ca_concepts.H>#include <tpl_ca_neighborhood.H>Go to the source code of this file.
Classes | |
| struct | Aleph::CA::ca_parallel_detail::is_tile< O > |
Detect whether O is a Tile<W, H> instantiation. More... | |
| struct | Aleph::CA::ca_parallel_detail::is_tile< Tile< W, H > > |
| struct | Aleph::CA::ca_parallel_detail::is_bit_cell_storage< Storage > |
| struct | Aleph::CA::ca_parallel_detail::is_bit_cell_storage< Bit_Cell_Storage< N > > |
| struct | Aleph::CA::Parallel_Engine_Config |
Configuration for Parallel_Synchronous_Engine. More... | |
| class | Aleph::CA::Parallel_Synchronous_Engine< Lattice, Rule, Neighborhood, Order > |
| Parallel synchronous double-buffered engine. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::CA |
| namespace | Aleph::CA::ca_parallel_detail |
Variables | |
| template<typename O > | |
| constexpr bool | Aleph::CA::ca_parallel_detail::is_tile_v = is_tile<O>::value |
| template<typename Lattice > | |
| constexpr bool | Aleph::CA::ca_parallel_detail::uses_bit_cell_storage_v |
Parallel synchronous engine for cellular automata (Phase 5).
Parallel_Synchronous_Engine<Lattice, Rule, Neighborhood, Order> is the multithreaded counterpart of Synchronous_Engine. It preserves the deterministic, bit-for-bit semantics of the sequential engine while distributing the per-step work across an Aleph::ThreadPool.
Design contract:
Synchronous_Engine for the same initial lattice. The synchronous double-buffer pattern guarantees that workers only read from current and only write to next, so the iteration order is irrelevant. Each cell is visited exactly once per step by exactly one worker.step(): the only heap activity per step is the bookkeeping intrinsic to the ThreadPool::enqueue machinery (a std::packaged_task per partition). The neighbour-gather buffer used by the rule lives on the worker stack, exactly like in the sequential engine.refresh_halo() (e.g. Ghost_Lattice), the engine refreshes it serially before each step. The halo is never written by the rule, so workers can read it concurrently without synchronisation.min_parallel_cells, or when num_partitions collapses to 1, the engine runs the same loop as the sequential engine without ever touching the thread pool. This keeps small CAs cheap.Partitioning strategy: contiguous row strips along axis 0 via ca-tiling.H. For row-major storage (the default for both Dense_Cell_Storage and Bit_Cell_Storage) this yields strictly contiguous memory per worker, which minimises false sharing on 64-byte cache lines.
The lower-dimensional ranks (Rank == 1 and Rank == 3) reuse the same row partitioning along axis 0. For 1D this means the full lattice is split into intervals of cells; for 3D it splits the outermost slab.
Definition in file tpl_ca_parallel_engine.H.