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

Plugin entry points for the Phase 2 Kokkos/CUDA surface solver. More...

#include "../solver/GpuPluginAbi.h"
#include "../solver/ISurfaceSolver.hpp"
#include "ExplicitKokkosSurfaceSolver.hpp"
#include <Kokkos_Core.hpp>
#include <cuda_runtime.h>
#include <cstring>
Include dependency graph for GpuPluginCuda.cpp:

Functions

OPENSWMM_GPU_ABI int openswmm_gpu_probe (OpenSwmmGpuProbe *out)
 Query the plugin for a usable GPU device.
 
OPENSWMM_GPU_ABI void * openswmm_make_gpu_explicit_solver (const OpenSwmmGpuProbe *)
 Construct the Kokkos explicit LTS marcher surface solver.
 

Detailed Description

Plugin entry points for the Phase 2 Kokkos/CUDA surface solver.

Exports the GpuPluginAbi.h contract for the openswmm_gpu_cuda plugin. Identical in shape to GpuPluginOmp.cpp — the probe advertises an NVIDIA device and the factory constructs the Kokkos marcher — but the solver's execution space is Kokkos::Cuda (selected by the OPENSWMM_GPU_EXECSPACE_CUDA define the CMake target sets), so the whole RHS / preconditioner / vector pipeline runs device-resident.

Kokkos is initialized lazily on first solver construction and is intentionally NOT finalized (same rationale as the OpenMP plugin): only this plugin uses Kokkos, and finalizing at dlclose risks destroying device Views that outlive the call.

Compiles only with a CUDA toolchain (nvcc / CUDA-clang) against a CUDA-enabled Kokkos. Not buildable on macOS/Apple Silicon.

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

Function Documentation

◆ openswmm_gpu_probe()

OPENSWMM_GPU_ABI int openswmm_gpu_probe ( OpenSwmmGpuProbe * out)

Query the plugin for a usable GPU device.

Must be cheap and side-effect-free beyond backend initialization.

Parameters
outCaller-allocated struct to fill. Zero-initialized on entry by the plugin.
Returns
0 on success with at least one usable device; non-zero if no device is available or the probe failed. A non-zero return tells the core to fall back to the CPU solver.

◆ openswmm_make_gpu_explicit_solver()

OPENSWMM_GPU_ABI void * openswmm_make_gpu_explicit_solver ( const OpenSwmmGpuProbe * probe)

Construct the Kokkos explicit LTS marcher surface solver.

The only solver factory in the contract: the core dlsym()s it and falls back to the serial CPU ExplicitInertialSolver when a plugin does not export it. Implements BOTH cell closures (FLAT and VFR). Returns an ISurfaceSolver* (as void*) owned by the caller, or NULL.