Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ca-tiling.H File Reference

Domain-decomposition utilities for the parallel CA engine. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <ah-errors.H>
#include <ca-traits.H>
Include dependency graph for ca-tiling.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::CA::Range1D
 Half-open integer interval [begin, end). More...
 
struct  Aleph::CA::Row_Partition< Rank >
 Row partitioning along axis 0. More...
 
struct  Aleph::CA::Column_Partition< Rank >
 Column partitioning along the last axis. More...
 
struct  Aleph::CA::Tile2D_Range
 2D tile descriptor: a rectangle in axis-0 / axis-1 coordinates. More...
 
struct  Aleph::CA::Block_Partition_2D
 2D blocked partitioning into a grid of parts_y x parts_x. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::CA
 
namespace  Aleph::CA::ca_tiling_detail
 

Functions

constexpr Range1D Aleph::CA::split_range_balanced (const ca_size_t n, const ca_size_t parts, const ca_size_t idx) noexcept
 Balanced split of [0, n) into parts contiguous ranges.
 
constexpr bool Aleph::CA::should_run_sequential (const ca_size_t cells, const ca_size_t num_partitions, const ca_size_t min_cells) noexcept
 Decide whether a workload should run sequentially.
 
constexpr std::uint64_t Aleph::CA::ca_tiling_detail::spread_bits_2 (const std::uint32_t v) noexcept
 Spread the low bits bits of v so that they occupy even positions.
 
constexpr std::uint64_t Aleph::CA::ca_tiling_detail::spread_bits_3 (const std::uint32_t v) noexcept
 Spread the low bits bits of v so that they occupy every third position (used for 3D Morton codes).
 
constexpr std::uint64_t Aleph::CA::morton_encode_2d (const std::uint32_t x, const std::uint32_t y) noexcept
 Morton (Z-order) encoding of (x, y).
 
constexpr std::uint64_t Aleph::CA::morton_encode_3d (const std::uint32_t x, const std::uint32_t y, const std::uint32_t z) noexcept
 Morton (Z-order) encoding of (x, y, z).
 

Detailed Description

Domain-decomposition utilities for the parallel CA engine.

This Phase-5 helper centralises the deterministic, balanced partitioning of a cellular-automaton iteration domain across an arbitrary number of workers. The strategies are intentionally pure arithmetic so the parallel engine can split and re-split without any synchronisation cost: every worker computes its slice from (rank, extents, partition_idx, num_partitions).

Partitions produced here cover the iteration domain exactly once with disjoint, contiguous ranges along the chosen axis or tile grid. This is the minimal contract required for the synchronous CA step, whose writes go to the next-buffer only and never read back from it inside the same step.

Catalogue:

  • Range1D : [begin, end) interval helper.
  • split_range_balanced : balanced split of [0, n) into parts.
  • Row_Partition : axis-0 row strips for any rank.
  • Column_Partition : axis-(rank-1) column strips for any rank.
  • Block_Partition_2D : 2D tile grid for rank == 2 lattices.
  • morton_encode_2d / morton_encode_3d : Z-order encoding (cache-friendly schedule hint for higher-dimensional CAs).

Every helper is constexpr where the standard library allows and has no run-time allocations. The primitives below are independent of the engine: they can be reused by hex/triangular variants in Phase 6 or by the IO helpers in Phase 11 as long as the iteration domain is rectangular.

Author
Leandro Rabindranath Leon

Definition in file ca-tiling.H.