|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0380 |
| Class | KNOWN-LIMITATION |
| Severity | 2 |
| Status | ready |
Models: Net/NetStructureWithConstraints
Found: 2026-10-14, feature nswc-node-state (plan C1, read at 85cb274)
Timing seen while making the baselines (not profiled): the test NetStructureWithConstraints_RegressionThreads (NumThreads 2, 0.2 s simulated) takes about 9 s of wall time, about 45 ms per step, against about 0.3 ms per step for the serial NetStructureWithConstraints_Regression (same net, 2 s simulated).
Each OdeFcn opens, one after the other (not nested):
net_threads::SumForcesInChunks (src/net/NetThreads.h:65), #pragma omp parallel num_threads(chunks), a team of 2;#pragma omp parallel for of the default team size in CalcStateDerivatives (NetStructureWithConstraints.cpp:597, 617, 637), which run in the serial case too.The cause is not known. Candidates: the OpenMP runtime switching between team sizes on every call, idle-thread wait policy, or the tiny per-region work (the test net has a few nodes). NetStructure has the same chunked loop but no parallel for in its derivative loop (NetStructure.cpp:557-582, commented out).
NumThreads > 1 can make a small or medium net far slower than serial. Large nets were not measured.
Measure first (per-region timing, OMP_WAIT_POLICY, a larger net). Then likely drop the parallel for in CalcStateDerivatives (a trivial per-node loop), as NetStructure did.
A timing comparison of the two regression fixtures, or a larger net, serial against NumThreads 2.
Results are unchanged by any fix of this kind (the derivative loop writes disjoint entries).