64 for (std::size_t i = 0; i <
lat.size(0); ++i)
65 std::putchar(
lat.at({static_cast<ca_index_t>(i)}) != 0 ?
'#' :
'.');
73 for (std::size_t i = 0; i < a.
size(0); ++i)
74 if (a.
at({static_cast<ca_index_t>(i)}) != b.
at({static_cast<ca_index_t>(i)}))
88 cfg.min_parallel_cells = 0;
92 std::printf(
"\n--- Wolfram rule %u, %zu cells, %zu generations ---\n",
114 cfg.min_parallel_cells = 0;
121 std::printf(
"\nrule=%-3u N=%-7zu steps=%-6zu sequential=%.4fs parallel=%.4fs "
122 "speedup=%.2fx (parallel=%s)\n",
128 std::printf(
"*** divergence between sequential and parallel rule %u ***\n",
129 static_cast<unsigned>(
rule_no));
138 std::printf(
"Aleph::CA Phase-5 example: parallel 1D Wolfram CAs\n");
147 bench(30, 1u << 17, 200);
148 bench(110, 1u << 17, 200);
150 std::printf(
"\nParallel Wolfram rules 30 and 110 matched the sequential reference.\n");
Tiny chrono-based timer used by the CA module Examples.
Common typedefs and tag types for the Cellular Automata module.
User-supplied list of offsets for arbitrary connectivity.
Lattice that adds boundary-aware access on top of a storage.
void set(const coord_type &c, const state_type &v)
Strict write: throws if c is out of range.
const extents_type & extents() const noexcept
ca_size_t size() const noexcept
state_type at(const coord_type &c) const
Strict access: throws if c is out of range.
Parallel synchronous double-buffered engine.
void run(const std::size_t steps)
Run several synchronous steps.
const Lattice & frame() const noexcept
Return the current frame.
void step()
Apply the rule to every cell once and swap buffers.
Synchronous double-buffered engine.
void run(const std::size_t steps)
Run several synchronous steps.
const Lattice & frame() const noexcept
Return the current frame.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
const char * format_throughput(double cells_per_second)
Format a "cells per second" rate as "X.XX M cells/s".
Coord_Vec< N > Offset_Vec
Default offset vector (aliases Coord_Vec).
double bench_seconds(F &&f)
Run f() once and return the wall-clock time it took, in seconds.
constexpr Lookup_Rule< 2, 2 > make_wolfram_elementary_rule(std::uint8_t rule_no) noexcept
Build the elementary 1D Wolfram rule rule_no (0..255) as a Lookup_Rule<2, 2> over neighbourhood {-1,...
Main namespace for Aleph-w library functions.
Out-of-range neighbours behave as if the lattice ended.
Configuration for Parallel_Synchronous_Engine.
std::size_t num_partitions
Number of partitions per step.
Synchronous double-buffered engine for cellular automata.
Cellular automata lattice with pluggable boundary policies.
Neighborhoods catalogue for Aleph::CA.
Parallel synchronous engine for cellular automata (Phase 5).
Rule mechanisms for Aleph::CA.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).