OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::twoD::GpuExecutionOwner Class Reference

#include <GpuExecutionOwner.hpp>

Collaboration diagram for openswmm::twoD::GpuExecutionOwner:

Public Member Functions

 GpuExecutionOwner ()
 Start a dedicated synchronous-dispatch worker.
 
 ~GpuExecutionOwner ()
 Stop and join a nonresident execution owner after queued work drains.
 
 GpuExecutionOwner (const GpuExecutionOwner &)=delete
 
template<class F>
auto invoke (F &&fn) -> std::invoke_result_t< F >
 Execute one callable on the controlling thread and wait for completion.
 

Static Public Member Functions

static std::shared_ptr< GpuExecutionOwner > shared ()
 Acquire the process-resident controlling thread for matched GPU plugins.
 

Constructor & Destructor Documentation

◆ GpuExecutionOwner() [1/2]

openswmm::twoD::GpuExecutionOwner::GpuExecutionOwner ( )
inline

Start a dedicated synchronous-dispatch worker.

Postcondition
Constructs an empty queue and a worker running work(). Thread creation may throw std::system_error; no partially live owner is returned.
Note
Normally use shared(). This constructor does not initialize Kokkos or load a plugin.
Here is the caller graph for this function:

◆ ~GpuExecutionOwner()

openswmm::twoD::GpuExecutionOwner::~GpuExecutionOwner ( )
inline

Stop and join a nonresident execution owner after queued work drains.

Precondition
No concurrent or later invoke() calls; destructor must run outside its worker thread. Never destroy under a DLL loader lock.
Postcondition
Sets stopping, wakes the worker, drains already queued tasks and joins it. Process-resident shared() instances intentionally avoid teardown-time destruction.

◆ GpuExecutionOwner() [2/2]

openswmm::twoD::GpuExecutionOwner::GpuExecutionOwner ( const GpuExecutionOwner & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ invoke()

template<class F>
auto openswmm::twoD::GpuExecutionOwner::invoke ( F && fn) -> std::invoke_result_t<F>
inline

Execute one callable on the controlling thread and wait for completion.

Template Parameters
FCallable type; must be invocable with no arguments.
Parameters
[in]fnForwarded callable, moved/copied into an owned queued task; captures may borrow buffers only until invoke returns.
Returns
Callable result, including void/reference results according to std::invoke_result_t<F>. Exceptions from the callable are rethrown through the future; allocation/queue failures may also propagate.
Note
Reentrant calls from the worker execute inline. Other callers enqueue under a mutex and block; queued calls are serialized. Owner must remain alive, and destruction must not race this call. Does not retain caller buffers after the synchronous result is delivered.

◆ shared()

static std::shared_ptr< GpuExecutionOwner > openswmm::twoD::GpuExecutionOwner::shared ( )
inlinestatic

Acquire the process-resident controlling thread for matched GPU plugins.

Returns
Shared ownership handle to the one intentionally resident owner; a static allocation retains it through process teardown.
Note
First use allocates and starts a thread and may throw. Factory must pin the containing module before first use, avoiding thread join under the Windows loader lock. Later acquisitions are synchronized by C++ static initialization.

The documentation for this class was generated from the following file: