Expand description
SoA (Structure-of-Arrays) extraction for GPU-friendly data layout.
ABM agents are stored as AoS (Array-of-Structures) in AgentStore.
For GPU kernels, we need flat contiguous arrays of each field.
SoaExtractable lets agent types define how to extract/write-back
their data to/from flat f32 buffers suitable for GPU upload.
For workloads that require f64 precision (scientific simulations,
long time horizons, or ill-conditioned dynamics), implement
SoaExtractableF64 instead of or alongside SoaExtractable.
The two traits are independent: an agent type may implement either,
both, or neither. CUDA kernels that target f64 must declare double
parameters.
Traits§
- SoaExtractable
- Trait for agents whose numeric fields can be extracted into SoA buffers and written back from SoA buffers after GPU computation.
- SoaExtractable
F64 - Like
SoaExtractablebut usingf64columns.
Functions§
- cast_
columns_ f32_ to_ f64 - Convenience helper: upcast
f32columns tof64columns. - cast_
columns_ f64_ to_ f32 - Convenience helper: downcast
f64columns tof32columns. - extract_
soa - Extract SoA buffers from an
AgentStore. - extract_
soa_ f64 - Extract
f64SoA buffers from anAgentStore. - write_
back_ soa - Write SoA buffers back into an
AgentStore. - write_
back_ soa_ f64 - Write
f64SoA buffers back into anAgentStore.