OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GpuPluginAbi.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
40
41#ifndef OPENSWMM_ENGINE_2D_GPU_PLUGIN_ABI_H
42#define OPENSWMM_ENGINE_2D_GPU_PLUGIN_ABI_H
43
44/*
45 * Export/visibility marker for the two ABI entry points.
46 *
47 * The declaration here and the definition in each plugin .cpp must agree on
48 * linkage or MSVC rejects the definition with C2375 ("redefinition; different
49 * linkage") — a plain `extern "C"` declaration followed by an
50 * `__declspec(dllexport)` definition is a mismatch. A plugin translation unit
51 * defines OPENSWMM_GPU_PLUGIN_BUILD (see the gpu CMakeLists) so it both
52 * declares and defines the symbols as dllexport. The core never link-imports
53 * these (it resolves them via dlsym/GetProcAddress), so the non-plugin case is
54 * a no-op marker.
55 */
56#if defined(_WIN32)
57# if defined(OPENSWMM_GPU_PLUGIN_BUILD)
58# define OPENSWMM_GPU_ABI __declspec(dllexport)
59# else
60# define OPENSWMM_GPU_ABI
61# endif
62#elif defined(__GNUC__)
63# define OPENSWMM_GPU_ABI __attribute__((visibility("default")))
64#else
65# define OPENSWMM_GPU_ABI
66#endif
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
81#define OPENSWMM_GPU_ABI_VERSION 4
82#define OPENSWMM_GPU_ABI_VERSION_ENV_THREADS_FALLBACK 3
83
92
107
120
130
141
142#ifdef __cplusplus
143} /* extern "C" */
144#endif
145
146#endif /* OPENSWMM_ENGINE_2D_GPU_PLUGIN_ABI_H */
OPENSWMM_GPU_ABI int openswmm_gpu_host_threads(void)
(v4, optional) Host thread count the plugin's Kokkos runtime is initialised with; 0 when not yet init...
Definition GpuPluginOmp.cpp:92
OPENSWMM_GPU_ABI int openswmm_gpu_probe(OpenSwmmGpuProbe *out)
Query the plugin for a usable GPU device.
Definition GpuPluginCuda.cpp:61
OpenSwmmGpuVendor
Definition GpuPluginAbi.h:85
@ OPENSWMM_GPU_VENDOR_OPENMP
Definition GpuPluginAbi.h:90
@ OPENSWMM_GPU_VENDOR_HIP
Definition GpuPluginAbi.h:88
@ OPENSWMM_GPU_VENDOR_CUDA
Definition GpuPluginAbi.h:87
@ OPENSWMM_GPU_VENDOR_SYCL
Definition GpuPluginAbi.h:89
@ OPENSWMM_GPU_VENDOR_NONE
Definition GpuPluginAbi.h:86
OPENSWMM_GPU_ABI void * openswmm_make_gpu_explicit_solver(const OpenSwmmGpuProbe *probe)
Construct the Kokkos explicit LTS marcher surface solver.
Definition GpuPluginCuda.cpp:87
#define OPENSWMM_GPU_ABI
Definition GpuPluginAbi.h:65
Definition GpuPluginAbi.h:94
unsigned long long device_mem_bytes
Definition GpuPluginAbi.h:99
int device_count
Definition GpuPluginAbi.h:96
char device_name[128]
Definition GpuPluginAbi.h:98
int requested_threads
Definition GpuPluginAbi.h:105
int abi_version
Definition GpuPluginAbi.h:95
int vendor
Definition GpuPluginAbi.h:97