include/pops/runtime/config/runtime_params.hpp File ReferenceΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
RuntimeParams: carrier for the RUNTIME PARAMETERS of a DSL model (P7-b). More...
Include dependency graph for runtime_params.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | pops::RuntimeParams |
| FLAT carrier (fixed size, by value) of the runtime parameter values of a block. More... | |
Namespaces | |
| namespace | pops |
Variables | |
| constexpr int | pops::kMaxRuntimeParams = 32 |
| Maximum number of runtime parameters per DSL block. | |
Detailed Description
RuntimeParams: carrier for the RUNTIME PARAMETERS of a DSL model (P7-b).
A runtime parameter is declared on the Python side via pops.dsl.Param(..., kind="runtime"); its value can be CHANGED at run time WITHOUT recompiling the .so. CONST parameters (kind="const") stay inlined HARD into the .so at codegen (bit-identical to history: this work does NOT touch their path).
MECHANICS. The codegen (python/pops/dsl.py) assigns each runtime parameter a STABLE INDEX (sorted order of names) and emits, wherever the formula reads that parameter, params.get(<index>) instead of a literal constant. Each generated block (hyperbolic / source / elliptic) that READS at least one runtime parameter then carries a member pops::RuntimeParams params{} initialized to the DECLARATION value (so, without a runtime set call, the block behaves EXACTLY as with a const param: the declaration value is baked into the member default). At run time, the ABI of the AOT .so (compiled_block_abi.hpp) transports a flat block of doubles; each call rebuilds the model then OVERWRITES params.values[k] with the supplied value -> the behavior changes without recompilation.
DEVICE-CLEAN. RuntimeParams is a trivially copyable aggregate (array of Real by value, no allocation, no std::), so copyable on device and readable in a kernel: get() is POPS_HD. The size is FIXED (kMaxRuntimeParams) to stay allocation-free; a model exceeding this bound is rejected on the Python side (codegen), never here.
Generated by