include/pops/runtime/builders/compiled/dsl_block.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
|
add_compiled_model: wires a COMPILED model (a CompositeModel, typically generated by the DSL then included at COMPILE time) as a NATIVE block of the System. More...
#include <pops/core/model/physical_model.hpp>#include <pops/runtime/builders/block/block_builder.hpp>#include <pops/runtime/system.hpp>#include <functional>#include <string>#include <utility>
Include dependency graph for dsl_block.hpp:Go to the source code of this file.
Namespaces | |
| namespace | pops |
Functions | |
| template<class Model > | |
| void | pops::add_compiled_model (System &sys, const std::string &name, Model model, const std::string &limiter="minmod", const std::string &riemann="rusanov", const std::string &recon="conservative", const std::string &time="explicit", double gamma=1.4, int substeps=1, bool evolve=true, int stride=1, double positivity_floor=0) |
Adds model (CompositeModel) as a native block of sys with the requested scheme (limiter x riemann, reconstruction, time treatment). | |
Detailed Description
add_compiled_model: wires a COMPILED model (a CompositeModel, typically generated by the DSL then included at COMPILE time) as a NATIVE block of the System.
Difference with System::add_compiled_block (.so + extern "C" ABI + flat-array marshaling, for RUNTIME prototyping on the Python side): here the model is known at compile time, so block_builder builds the closures on the System's REAL GRID CONTEXT (grid_context) and the block runs EXACTLY the production path – the residual does fill_boundary (MPI halos) + assemble_rhs (Kokkos) on the System's real MultiFab, WITHOUT any copy: the SAME make_block as add_block. Parity validated on CPU (build/ AND Kokkos Serial backend): eval_rhs bit-identical to add_block (see tests/test_compiled_model_parity.cpp).
DEVICE (Kokkos Cuda backend): the make_block TRANSPORT path is built on NAMED FUNCTORS (build_block via AdvanceExplicit/AdvanceImex/RhsInto/BlockRhsEval, make_max_speed via MaxSpeed; see block_builder.hpp), instead of lambdas first-instantiated from this calling TU. nvcc then reliably emits the nested device kernel (AssembleRhsKernel): the A==B parity (dres=0) of the transport residual is obtained on a CUDA device. This is the "compiled" backend of the ideal m.compile_or_jit() for a production binary.
THE SAME limit held for the ELLIPTIC / MESH path of solve_fields (fill_boundary, physical BC, Poisson operator, GS smoother, MultiFab arithmetic), kept as inline extended lambdas and thus victims of the SAME nvcc bug: Release Cuda WITHOUT -g segfaults in solve_fields (Heisenbug: OK Serial + compute-sanitizer + -g). These kernels are likewise converted to named functors (mf_arith / fill_boundary / physical_bc / poisson_operator / geometric_mg). The CUDA parity of the FULL PRODUCTION path (solve_fields + transport, np=1) is validated once the solve_fields segfault above is closed; the MPI multi-rank cases of the non-split System remain a separate follow-up. Device-codegen provenance: docs/validation/HEADER_PROVENANCE.md.
Generated by