Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
bench_gray_scott_512.cc
Go to the documentation of this file.
1/*
2 Aleph_w
3
4 Data structures & Algorithms
5 version 2.0.0b
6 https://github.com/lrleon/Aleph-w
7
8 This file is part of Aleph-w library
9
10 Copyright (c) 2002-2026 Leandro Rabindranath Leon
11*/
12
18#include <cstddef>
19#include <cstdint>
20
23#include <tpl_ca_engine.H>
24#include <tpl_ca_lattice.H>
25#include <tpl_ca_neighborhood.H>
26#include <tpl_ca_storage.H>
27
28using namespace Aleph::CA;
29using namespace Aleph::CA::Bench;
30
31namespace
32{
33
36
41Grid make_seed(const ca_size_t side)
42{
43 Grid frame({side, side}, Cell{1.0, 0.0});
44 const ca_size_t patch = side / 5;
45 const ca_size_t begin = side / 2 - patch / 2;
46 for (ca_size_t r = begin; r < begin + patch; ++r)
47 for (ca_size_t c = begin; c < begin + patch; ++c)
48 frame.set({static_cast<ca_index_t>(r), static_cast<ca_index_t>(c)}, Cell{0.5, 0.25});
49 return frame;
50}
51
52} // namespace
53
54int main()
55{
56 constexpr ca_size_t side = 512;
57 constexpr std::size_t steps = 1'000;
58 const Grid seed = make_seed(side);
59 const double processed_cells
60 = static_cast<double>(side) * static_cast<double>(side) * static_cast<double>(steps);
61
62 const Bench_Result result = measure("gray_scott_512", processed_cells, resolve_repeats(3), [&]
63 {
64 Gray_Scott_Rule<double> rule(0.0350, 0.0650, 0.16, 0.08);
66 engine.run(steps);
67 });
68
69 emit_json(result);
70 return 0;
71}
int main()
Shared harness for the cellular-automata performance-gate anchors.
size_t steps
Definition ca-c-api.h:126
Gray-Scott reaction-diffusion rule.
Lattice that adds boundary-aware access on top of a storage.
Moore (Chebyshev) neighborhood of radius R in N dimensions.
Synchronous double-buffered engine.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Definition Blossom.H:466
std::size_t resolve_repeats(const std::size_t fallback)
Resolve the number of timed repetitions for one anchor.
void emit_json(const Bench_Result &result, std::ostream &out=std::cout)
Print one benchmark result as a single structured JSON object.
Bench_Result measure(std::string name, const double processed_cells, std::size_t repeats, Work &&work)
Time a kernel with one warmup pass plus a median of timed passes.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
Definition ca-traits.H:63
Outcome of one measured anchor benchmark.
Zero-gradient (Neumann) boundary.
Definition ca-traits.H:152
Two-field state for reaction-diffusion cellular automata.
ValueArg< size_t > seed
Definition testHash.C:53
static mt19937 engine
gsl_rng * r
Continuous and memory-bearing CA rules (Phase 9).
Synchronous double-buffered engine for cellular automata.
Cellular automata lattice with pluggable boundary policies.
Neighborhoods catalogue for Aleph::CA.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).