OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SurfaceSolverFactory.hpp File Reference

Runtime selection of the 2D surface solver backend (Phase 4). More...

#include <memory>
#include <string>
#include "GwRechargeBackend.hpp"
Include dependency graph for SurfaceSolverFactory.hpp:

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::twoD
 

Functions

std::unique_ptr< ISurfaceSolver > openswmm::twoD::makeSurfaceSolver (const SolverOptions2D &opts, std::string *chosen=nullptr, int n_cells=0, bool plugin_capable=true)
 Construct the 2D surface solver per the runtime backend policy.
 
GwRechargeBackend openswmm::twoD::makeGwRechargeBackend (const SolverOptions2D &opts, int n_cells)
 Optional stateless host recharge operator. Surface/water/transfer ownership stays with the built-in marcher; absent/unsupported extensions select CPU.
 

Detailed Description

Runtime selection of the 2D surface solver backend (Phase 4).

Resolves which ISurfaceSolver to construct based on the OPENSWMM_2D_BACKEND policy, discovering and dlopen()ing a GPU plugin when one is present and usable, and falling back to the serial CPU ExplicitInertialSolver otherwise. This is the runtime half of the portable-GPU strategy — the core stays Kokkos/GPU-free; the device backend lives entirely in a separately built plugin loaded here at runtime.

Selection policy. The mode comes from the OPENSWMM_2D_BACKEND environment variable when set (case-insensitive), else from the model's [2D_OPTIONS] BACKEND (SolverOptions2D::backend): "auto" (default) : try device plugins (cuda, hip, sycl) in order above the device mesh-size floor, then the OpenMP plugin above its own (higher) floor; if none loads with a usable device, use the CPU solver. "cpu" : always the serial CPU solver (no discovery). "omp"|"cuda"|"hip"|"sycl" : load exactly that plugin, bypassing the size floors; if it is absent or has no usable device, warn and fall back to CPU (never hard-fail on GPU absence).

Plugin search path: OPENSWMM_GPU_PLUGIN_PATH (os-separated list), then the directory of the engine shared library, then its gpu subdirectory.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0