![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Functions | |
| int | logicalCpus () |
| int | ompMaxThreads () |
| int | ompAvailable () |
| 1 when built with SWMM_USE_OPENMP, else 0. | |
| int | perfCores () |
| int | kokkosOmpThreads () |
| void | setKokkosOmpThreads (int n) |
| Recorded by the engine when it hands a thread count to the Kokkos plugin. | |
| int | hostReservedThreads () |
| bool | isOversubscribed (int threads) |
| int | resolveRequested (int requested, const char *what, std::vector< std::string > *warnings) |
| Resolve a [OPTIONS] THREADS request into a thread count. | |
| int | dwThreads (int requested, int n_conduits, std::vector< std::string > *warnings) |
| Dynamic-wave Picard team size for a THREADS request. | |
| int | twoDThreads (int requested, int n_triangles, std::vector< std::string > *warnings) |
| 2D CPU-marcher team size for a THREADS request. | |
Variables | |
| constexpr int | kMinConduitsPerThread = 100 |
| int openswmm::threadinfo::dwThreads | ( | int | requested, |
| int | n_conduits, | ||
| std::vector< std::string > * | warnings ) |
Dynamic-wave Picard team size for a THREADS request.
resolveRequested(), then the model-size gate (n_conduits / kMinConduitsPerThread, applied to explicit values too — with a warning), then, for auto only, the macOS performance-core clamp (perfCores() - 2). Does NOT consult SWMM_DW_THREADS; the caller handles that override.
| int openswmm::threadinfo::hostReservedThreads | ( | ) |
Threads the HOST application keeps busy alongside the engine (OPENSWMM_HOST_RESERVED_THREADS; 0 when unset or invalid). A GUI that runs the engine in-process sets it — its own event thread, a render thread, the engine IO thread — so that isOversubscribed() and the active spin-wait decision see the whole process, not just the team.
| bool openswmm::threadinfo::isOversubscribed | ( | int | threads | ) |
True when threads plus hostReservedThreads() exceed the logical CPU count (the runtime would oversubscribe). Used to decide whether an active spin-wait policy is safe: a spinner waiting on a DESCHEDULED spinner turns every barrier into a scheduler-quantum stall.
| int openswmm::threadinfo::kokkosOmpThreads | ( | ) |
Threads the Kokkos OpenMP 2D backend was initialised with in this process; 0 until the plugin initialises (or when no plugin is loaded).
| int openswmm::threadinfo::logicalCpus | ( | ) |
Logical processors visible to the OS (SMT / hyper-threads included). std::thread::hardware_concurrency(); 0 when unknown.
| int openswmm::threadinfo::ompAvailable | ( | ) |
1 when built with SWMM_USE_OPENMP, else 0.
| int openswmm::threadinfo::ompMaxThreads | ( | ) |
omp_get_max_threads() as seen by this process — the OpenMP runtime's default team size. Lower than logicalCpus() when OMP_NUM_THREADS, OMP_THREAD_LIMIT or a CPU-affinity mask limits the process. 1 when the engine is built without OpenMP.
| int openswmm::threadinfo::perfCores | ( | ) |
macOS: logical CPUs on the PERFORMANCE cluster (hw.perflevel0.logicalcpu); 0 on Intel Macs, other platforms, or sysctl failure.
| int openswmm::threadinfo::resolveRequested | ( | int | requested, |
| const char * | what, | ||
| std::vector< std::string > * | warnings ) |
Resolve a [OPTIONS] THREADS request into a thread count.
Rule (plan §2):
| requested | [OPTIONS] THREADS value. |
| what | Short label for warning text ("OpenMP team", "dynamic wave", "2D"). |
| warnings | Sink for human-readable warnings; may be nullptr. |
| void openswmm::threadinfo::setKokkosOmpThreads | ( | int | n | ) |
Recorded by the engine when it hands a thread count to the Kokkos plugin.
| int openswmm::threadinfo::twoDThreads | ( | int | requested, |
| int | n_triangles, | ||
| std::vector< std::string > * | warnings ) |
2D CPU-marcher team size for a THREADS request.
resolveRequested(), then n_triangles < 4 * nt → 1 (warned when it reduces an explicit request).
|
constexpr |
Minimum conduits of momentum work per dynamic-wave team thread before an extra thread pays for its barriers (PERFORMANCE-ONLY; bit-identical).