include/pops/runtime/builders/compiled/native_loader.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
|
NativeLoader: loading a .so generated by the DSL (JIT / AOT / native paths) + ABI guard. More...
#include <pops/core/state/state.hpp>#include <pops/core/foundation/types.hpp>#include <pops/core/state/variables.hpp>#include <pops/mesh/layout/box_array.hpp>#include <pops/mesh/geometry/geometry.hpp>#include <pops/mesh/storage/multifab.hpp>#include <pops/mesh/boundary/physical_bc.hpp>#include <pops/runtime/dynamic/abi_key.hpp>#include <pops/runtime/dynamic/dynamic_model.hpp>#include <pops/runtime/context/grid_context.hpp>#include <pops/runtime/system.hpp>#include <algorithm>#include <cmath>#include <cstddef>#include <pops/runtime/dynamic/dynlib.hpp>#include <functional>#include <memory>#include <stdexcept>#include <string>#include <vector>
Include dependency graph for native_loader.hpp:Go to the source code of this file.
Classes | |
| struct | pops::native_loader::BlockMeta |
| OPTIONAL metadata read by dlsym on a generated .so (names / roles / gamma). More... | |
Namespaces | |
| namespace | pops |
| namespace | pops::native_loader |
Macros | |
| #define | POPS_AUX_MARSHAL(name, idx) |
| #define | POPS_AUX_MARSHAL(name, idx) |
Functions | |
| template<class Impl > | |
| std::vector< double > | pops::native_loader::marshal_aux_halo (Impl *P, int naux) |
ADC-369: marshal the aux for a COMPILED block – the naux valid components (component-major, like copy_state) PLUS an APPEND-ONLY tail of 2*naux doubles: (type, value) per component, carrying the per-field halo policy that make_grid applies to that component's physical-face ghosts. | |
| POPS_HD double | pops::native_loader::limited_slope (double am, double ap, int recon) |
MUSCL limited slope of a cell from backward difference am and forward ap. | |
| template<int NV> | |
| std::vector< double > | pops::native_loader::host_residual (const IModel< NV > &m, const std::vector< double > &U, const std::vector< double > &AUX, int n, double dx, int recon) |
| Host residual R = -div F* + S(U, aux) (Rusanov, GLOBAL a_max like pops.PythonFlux, periodic) computed via an IModel: serves the DYNAMIC block (model loaded at runtime, virtual dispatch, off GPU). | |
| std::vector< std::string > | pops::native_loader::split (const std::string &s, char sep) |
Split s on sep (empty fields kept). | |
| VariableSet | pops::native_loader::parse_var_set (VariableKind kind, const std::string &names_csv, const std::string &roles_csv) |
| Builds a VariableSet from the CSV names / roles (parallel to names; EMPTY roles = not provided -> VariableSet without roles, index fallback on the coupling side). | |
| BlockMeta | pops::native_loader::read_block_meta (pops::dynlib::handle h) |
Reads (by dlsym, all OPTIONAL) the metadata symbols of an already-open .so (h). | |
| template<typename ImplT , int NV> | |
| void | pops::native_loader::push_dynamic (ImplT *P, const std::string &name, pops::dynlib::handle h, int substeps, std::vector< std::string > names, int recon) |
Builds a DYNAMIC block (IModel<NV> model loaded from the .so h) and adds it. | |
| template<typename ImplT > | |
| void | pops::native_loader::add_dynamic_block (System *self, ImplT *P, const std::string &name, const std::string &so_path, int substeps, const std::vector< std::string > &names, const std::string &recon) |
Body of System::add_dynamic_block. VERBATIM; self = the calling System, P = self->p_.get(). | |
| template<typename ImplT > | |
| void | pops::native_loader::add_compiled_block (System *self, ImplT *P, const std::string &name, const std::string &so_path, const std::string &limiter, const std::string &riemann, const std::string &recon, const std::string &time, int substeps, const std::vector< std::string > &names, double pos_floor=0) |
Body of System::add_compiled_block. VERBATIM; self = the calling System, P = self->p_.get(). | |
| template<typename ImplT > | |
| void | pops::native_loader::add_native_block (System *self, ImplT *P, const std::string &name, const std::string &so_path, const std::string &limiter, const std::string &riemann, const std::string &recon, const std::string &time, double gamma, int substeps, bool evolve, int stride, double pos_floor=0) |
| Body of System::add_native_block. | |
Detailed Description
NativeLoader: loading a .so generated by the DSL (JIT / AOT / native paths) + ABI guard.
Extracted VERBATIM from python/system.cpp (extraction PR #1, plan docs/SYSTEM_CPP_EXTRACTION_PLAN.md). STRICTLY bit-identical: no change of behavior, logic, or evaluation order – the code is moved as-is.
The closures of the three paths access internals of System::Impl (copy_state / write_state / aux / sp / ensure_aux_width) and out-of-line methods of System (install_block / grid_context). To stay free of a circular dependency on the definition of Impl (which stays PRIVATE to python/system.cpp), the loading functions are TEMPLATES parameterized on the real Impl type: python/system.cpp instantiates them with System::Impl after defining Impl. The pure helpers (host_residual, split, BlockMeta, ...) do not touch Impl and stay free inline functions (ODR-safe in a header).
Macro Definition Documentation
◆ POPS_AUX_MARSHAL [1/2]
| #define POPS_AUX_MARSHAL | ( | name, | |
| idx | |||
| ) |
◆ POPS_AUX_MARSHAL [2/2]
| #define POPS_AUX_MARSHAL | ( | name, | |
| idx | |||
| ) |
Generated by