OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GpuPluginSupport.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
15#include <cstdio>
16#include <exception>
17
18#ifndef OPENSWMM_GPU_BUILD_CONTRACT
19#error "GPU plugins require the generated build contract"
20#endif
22inline thread_local char error[512]{};
34template <class Initialize> void* make(Initialize initialize) noexcept {
35 error[0] = '\0';
36 try {
37 initialize();
38 return static_cast<ISurfaceSolver*>(new ExplicitKokkosSurfaceSolver());
39 } catch (const std::exception& e) {
40 std::snprintf(error, sizeof error, "%s", e.what());
41 } catch (...) {
42 std::snprintf(error, sizeof error, "Unknown plugin initialization failure");
43 }
44 return nullptr;
45}
46}
48 return OPENSWMM_GPU_BUILD_CONTRACT;
49}
54 delete static_cast<openswmm::twoD::ISurfaceSolver*>(solver);
55}
Kokkos (OpenMP/CUDA/HIP/SYCL) port of the explicit local-inertial FV marcher with tiered local timest...
Stable C ABI between the core engine and an optional GPU solver plugin.
#define OPENSWMM_GPU_ABI
Definition GpuPluginAbi.h:65
OPENSWMM_GPU_ABI void openswmm_destroy_gpu_explicit_solver(void *solver)
Destroy on the execution owner through the allocating plugin.
Definition GpuPluginSupport.hpp:53
OPENSWMM_GPU_ABI const char * openswmm_gpu_last_error()
Last construction error on this controlling thread; plugin-owned text.
Definition GpuPluginSupport.hpp:50
OPENSWMM_GPU_ABI const char * openswmm_gpu_build_contract()
v5 compatibility check, called BEFORE probe or factory.
Definition GpuPluginSupport.hpp:47
Abstract time integrator for the 2D surface-routing ODE system.
Definition ISurfaceSolver.hpp:61
Definition ExplicitKokkosSurfaceSolver.hpp:67
Definition GpuPluginSupport.hpp:21
void * make(Initialize initialize) noexcept
Construct a plugin-owned Kokkos surface marcher with thread-local diagnostics.
Definition GpuPluginSupport.hpp:34
thread_local char error[512]
Definition GpuPluginSupport.hpp:22