Skip to content

build: thread-safe Intel builds, value-safe floating point, openfast.exe version, faster wave kinematics - #80

Merged
SMI-Lab-Inha merged 19 commits into
devfrom
build/release-hardening
Nov 3, 2026
Merged

SMI-Lab-Inha merged 19 commits into
devfrom
build/release-hardening

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Summary

Release-build robustness for 0.4.0: separate CableDyn handles run safely from several threads under Intel ifx, every ifx build uses the value-safe floating-point model, openfast.exe names its real version, and the wave kinematics win back the cost of /fp:precise.

Threads and the Intel run-time

  • Automatic locals everywhere (/Qauto, -auto; -frecursive for gfortran without OpenMP). Without OpenMP, ifx kept fixed-size local arrays and CHARACTER locals in static storage, so concurrent initialisations failed ("tangent assembly failed").
  • No closures as callbacks. ifx calls internal procedures passed as arguments through trampolines on memory every thread shares; concurrent steps faulted there under every ifx option. The line step now takes a load object (CD_Cable_Step_Loads). The audit thread_safe_sources refuses closures, implicit SAVE, unreviewed static variables and missing flags; it fails on the old source.
  • Diagnostics counts are per system and per workspace, not process-wide tallies.
  • CableDyn_Close no longer pauses the whole OpenMP run-time under libiomp5/libomp. Since 0.1.0 every close called omp_pause_resource_all (a fix for GNU OpenMP's exit on MinGW-w64); the Intel and LLVM run-times pause every thread instead, and the next parallel region on another thread deadlocked resuming it. A non-static ifx build with OpenMP hung the threading gate 20 of 20 times; it now passes 20 of 20 with OMP_NUM_THREADS 1 and 4. GNU builds keep the pool join (c_api_threads_exit passes).
  • Long names: a failing OPEN of a name of about 600 characters or more ends the Intel run-time (STATUS_STACK_BUFFER_OVERRUN). Every user-path OPEN goes through CD_Path_Openable / CD_Open_Read / CD_Open_Write first.
  • Gates: c_api_threads (base, omp32, stress, mixed, exit) 50 of 50 under ifx and gfortran (before: every run failed under ifx), c_api_threads_mixed (7 decks x 4 threads), deck_reader_io and driver_cli_paths long-name cases.

Floating point and build

  • /fp:precise (-fp-model precise) for every ifx build and the OpenFAST Visual Studio projects, not only the static release: the ifx default /fp:fast broke nine bit-identity and accuracy gates. Heap arrays above 1 MiB in every ifx build; automatic locals in the OpenFAST VS project.
  • A number beyond the range of the kind (e.g. 1e309) is "not a finite number" on every compiler; core-linked C tests link through IFX in the static release.

openfast.exe version

The release patches the pinned OpenFAST v5.0.0 tree, so OpenFAST's own git describe --dirty stamped v5.0.0-dirty. The VS and CMake routes now stamp <OpenFAST describe>-CableDyn-<version> (v5.0.0-CableDyn-0.3.0 until the version bump), and the release smoke test fails unless openfast.exe -v prints exactly that. Verified on the release workflow (workflow_dispatch, artifacts only): PASS openfast.exe identity: OpenFAST-v5.0.0-CableDyn-0.3.0.

Wave kinematics

Block sine, cosine and exponential kernels (CableDyn_WaveMath) in CD_Component_Wave_Kinematics and CD_Sea_Kinematics: within 2.4 ulp (sine, cosine) and 1.12 ulp (exp) of quadruple precision over |phase| <= 1.65e6 (intrinsic fallback above), NaN propagated, IEEE semantics forced per file under GNU fast-math. Block and single-element results are bit-identical under every flag set (restart identity unaffected). Speed-ups, 1 thread: ifx chain_two_train_sea -33 %, line-break decks -14 %, lazy_wave_vessel_rao -9 %; gfortran -21 % / -9 % / 0 %.

Checks

  • gfortran: ctest 348 of 348; ifx static and non-static (OpenMP): the threading gates above.
  • Example A/B against dev: 49 of 53 identical. lazy_wave_vessel_rao and lazy_wave_bend_stiffener differ in the last printed digit (1e-7 in .out); the two 1800 s line-break decks drift after about 860 s by round-off growth in the post-break transient, the same size as the gfortran-vs-ifx difference of the unchanged code.
  • pre-commit, Sphinx -W, strict mypy (dev's 3 numpy-stub notes only), no symbol both in a PUBLIC list and declared PUBLIC.

…c release

With CABLEDYN_STATIC_WINDOWS_RELEASE the core archive holds /Qipo objects,
which only an IFX link reads. test_c_api_raw_small_dt and test_memory_growth
link cabledyn_core from a C main, so CMake linked them with link.exe, which
reported every CableDyn_* symbol unresolved (LNK2019, LNK1120) and stopped a
full build of the test suite with the release flags (Intel ifx 2025.3.2).
They now take LINKER_LANGUAGE Fortran in that configuration, as
test_lapack_guard_pages does everywhere. Other builds are unchanged.

Pre-existing on dev (6195432); not specific to a feature branch.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
…ry compiler

real_token_defect read a token spelled as a decimal number and judged the
value; a READ error made it give up, leaving the token to its row reader. The
GNU run-time reads a magnitude beyond HUGE (1e309) as Inf, which is then named
"not a finite number"; the Intel run-time stops the READ with a conversion
error, so an Intel build named the same deck "malformed POINTS row" or "wave
row value ... is not a number". A token of numeric shape that does not read
is now REAL_NONFINITE, the GNU verdict. test_deck_reader_io failed 2 checks
under Intel ifx 2025.3.2 (with /fp:precise); gfortran is unchanged.

Pre-existing on dev (6195432).

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
CD_Open_Input learnt that a deck or table was missing from a failing
OPEN(STATUS='OLD'). For a name longer than the Windows path limit,
CD_Native_Path hands the run-time an extended-length (\\?\) spelling, and the
Intel Fortran run-time of ifx 2025.3.2 ends the process with
STATUS_STACK_BUFFER_OVERRUN (0xC0000409) when such an OPEN of about 600
characters or more fails: it overruns a buffer while it formats the error. A
twenty-line program reproduces it (OPEN of "\\?\D:\missing_<580 d>.dat" stops
the process; 560 returns IOSTAT 43; INQUIRE of the same names returns). The
Windows wheel's DLL and the release driver crashed on a missing deck of 1100
characters (python/tests/test_native_model.py::
test_long_failure_message_is_kept_whole took the whole python_package test
down). An INQUIRE now finds the missing file first; the message is unchanged
("... (file not found)") and gfortran behaves as before.

A compiler run-time bug; pre-existing on dev (6195432). Other OPENs of
extended-length names that fail (outputs in a folder that does not exist)
take the same run-time path and are not covered here.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Separate C API handles (and Python objects) may run concurrently on
several threads. The Windows wheel and the release binaries are built
with Intel ifx without OpenMP, and there ifx keeps the fixed-size local
arrays and CHARACTER locals of every procedure in static storage (its
default /Qauto-scalar makes only numeric and LOGICAL scalars automatic):
every thread shares them. An initialisation that ran while other handles
stepped then failed with "tangent assembly failed" or "band scatter"
errors (c_api_threads, test_concurrent_initialisation_and_stepping_from_
threads). A twenty-line reproducer (16 threads filling and checking a
local array, a 3x3 local and a CHARACTER local) shows corrupted arrays
and internal I/O under the default flags and none under /Qauto.

/Qauto (-auto off Windows) for ifx and -frecursive for gfortran make
every local automatic. gfortran moves a local array above
-fmax-stack-var-size to static storage without -frecursive, but -fopenmp
already implies it, so the default gfortran build is unchanged.

The source has no other implicit static storage: no local is
initialised in its declaration, no DATA or COMMON, and the module
variables are the explicitly SAVEd registries, test hooks and
diagnostics tallies.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
With automatic locals, concurrent steps of separate handles still ended
the ifx builds with access violations and privileged-instruction faults.
A debug build symbolised through DbgHelp showed every faulting thread in
CD_Cable_Gen_Alpha_Step's residual evaluation calling the load or
added-mass callback, with the faulting instruction outside every loaded
module, on one page shared by all threads: the callbacks were internal
procedures of the EI = 0 line model (model_force, model_load_band,
model_added_mass_band, closing over the model), and ifx calls an internal
procedure passed as an argument through a trampoline kept in memory every
thread shares. A 40-line reproducer (an internal function passed through
an optional dummy to a procedure pointer in another module) gives wrong
results or crashes with two threads under the default flags, /Qauto and
/recursive alike, and runs clean with one.

The integrator now also takes the loads as an object:
CD_Cable_Step_Loads (CableDyn_Dynamic) with deferred force, banded-load
and banded added-mass bindings and flags for the roles it fills, passed
as `loads` to CD_Cable_Gen_Alpha_Step and CD_Cable_Initial_Acceleration
in place of the corresponding procedure arguments (which stay, for
callers without their own state). The line model passes a
model_step_loads pointing at itself (and at the blended inertia lengths
after a length change under the force blend), so its initialisation,
step and acceleration recompute keep the same calls in the same order.
No internal procedure is passed as an argument or pointed to anywhere
in src/ or app/ any more.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
c_api_threads steps one EI = 0 chain deck. Two gates cover the rest of
what separate handles may run at once:

- c_api_threads_mixed (test_c_api_threads --mixed): seven decks stepped
  together, four threads each, 40 steps, every final coupled load
  against the deck's serial reference: the EI = 0 chain and finite-EI
  cable of the coupled aggregate, viscoelastic and Syrope segments, the
  UMaine mixed deck, Free points, the Lozon power cable and a Free rod
  (new tests/data/c_api_free_rod.dat, stepped at its dtM).
- thread_safe_sources (tests/test_thread_safe_sources.py), compiler
  independent so that a gfortran CI run catches what only an ifx build
  shows: no internal procedure as a procedure value, no local
  initialised in its declaration and no DATA/COMMON, every variable in
  static storage on a reviewed list with its reason (50: the handle and
  instance registries, test hooks, opt-in profiles, diagnostics
  tallies), and the automatic-locals flags in CMakeLists.txt. A scratch
  source with a closure and an implicit SAVE checks the checks.

Measured with the static release flags (ifx 2025.3.2), 7 decks x 4
threads: the build before the two fixes fails the mixed gate 5 of 5
runs (access violations, heap corruption), automatic locals alone 5 of
5, the closure fix alone 5 of 5; with both it passes 50 of 50 (and
c_api_threads 50 of 50, against 20 of 20 failures before, 10 of 10 with
either fix alone). The source audit fails on the code before the fixes
(the closures in CableDyn_Model and CableDyn_DeckDriver, the missing
flags) and passes now.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
…un-time

The Intel Fortran run-time of ifx 2025.3.2 ends the process with
STATUS_STACK_BUFFER_OVERRUN (0xC0000409) when an OPEN of a name of about
600 characters or more fails, while it formats the error. CD_Native_Path
spells a path beyond the Windows limit in the extended-length (\\?\) form,
so any failing OPEN of a long user-supplied name hit it: the input deck
was covered by an INQUIRE (46f802d), the outputs were not. The release
driver given an output root in a folder that does not exist, three
200-character folders deep, crashed with 0xC0000409 before this change.

CableDyn_PathIO now answers in one place whether a runtime spelling
opens, CD_Path_Openable: src/cabledyn_path.c opens it with the system
(CreateFileA on the narrow name the run-time is given, OPEN_EXISTING for
reading, OPEN_ALWAYS for writing, which leaves an existing file as it is;
open() and fstat() elsewhere; a folder does not open) and closes it.
CD_Open_Read and CD_Open_Write (STATUS 'REPLACE' or a given status) ask
it before their OPEN and report 1 without an OPEN when it says no, and
CD_Open_Input (UTF-8 names) goes through CD_Open_Read in place of the
INQUIRE. Every OPEN of a user-supplied name uses them: the 25 output
files of the deck driver, the range graphs, the aggregate's static
profile, the keyword driver, the driver program (its write check, the
file-identity check, the mixed route's output and the nModes scan) and,
around their own OPENs, the OpenFAST adapter's native output and its
temporary-file removal. The messages are unchanged.

Gates: deck_reader_io opens names of 680 characters in a folder that
does not exist for writing, for reading and as an input, a folder for
reading, and runs a deck with such an output root; each returns a status
or the "cannot open output file" message, and a short name still writes
and reads back (a write probe leaves the file as it is).
driver_cli_paths runs the driver with that output root: exit 1 and
"cannot write output files" (0xC0000409 before, under ifx).

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The static release compiled CableDyn with the Intel default /fp:fast (only the
reference LAPACK took /fp:precise). That model lets the compiler reassociate
sums, divide by multiplying with a reciprocal and flush subnormals to zero,
each differently at every inlined (/Qipo) call site, so one expression rounds
differently on two code paths. Under Intel ifx 2025.3.2 the full test suite
of the release configuration then failed gates that hold two routes to the
same bits: hermite_cable_control (A), syrope (impl:commit-bit-identical),
model (committed-side twin), openfast_aggregate (zero CONTROL command against
an uncontrolled cable, restore), control_torsion (R, S), two_moving_ends (Z,
a held Coupled End B against a Fixed one); profile summed 0.030 + 0.005 s to
below 0.035 s; clamped_cable_ends' elastica secant stalled on equal residuals
and wrote NaN into its deck; deck_reader_io read subnormal deck values as zero.
With /fp:precise every one of them passes.

The first five and the last two fail on dev (6195432) as well; control_torsion
belongs to feat/torsion-routes-a, two_moving_ends to feat/two-moving-ends.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The OpenFAST Visual Studio project compiles the CableDyn adapter
(CableDyn_Types.f90, CableDyn_OF.f90) itself. Its OpenMP configurations
get automatic locals from /Qopenmp, the others did not: there ifx keeps
fixed-size local arrays and CHARACTER locals in static storage, which
every thread shares. Every configuration (Debug, Release, OpenMP,
Double, Matlab) now sets LocalVariableStorage="localStorageAutomatic"
(/Qauto, the setting's name in the Intel project system), as the CMake
build of the core does with every compiler, so all builds are uniform.
thread_safe_sources checks every compiler tool of the template.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
…e tallies

Four diagnostics tallies were module variables written from the step of
every model, so concurrent handles mixed their counts, and without OpenMP
(the ifx release) their !$OMP ATOMIC was inactive and increments could
be lost:

- n_fallback_entries (CableDyn_System), the subdivision-retry tripwire
  of CD_Step_System: now a component of CD_SystemType, outside the
  snapshot, so a restored step keeps its count.
  CD_System_Fallback_Count/Reset take the system; the aggregate gets
  CD_AGG_Fallback_Count/Reset.
- CD_COSASM_* (CableDyn_CosseratAssemble), the tangent and
  internal-force assembly counts and times: now components of
  CD_CosseratAssemblyWorkspace, kept by the workspace-backed kernels; the
  dense kernel without a workspace no longer counts or reads the clock
  (nothing read it).
- CD_COSDYN_* (CableDyn_CosseratDynamic), the modified-Newton
  stale-tangent counts and histograms: now components of
  CD_CosseratGenAlphaWorkspace; CD_Reset_Cosserat_Dyn_Counts and
  CD_Reset_Cosserat_Asm_Counts take the workspace.
- n_substep_recoveries (CableDyn_HermiteCableDynamic): each model
  already counts its recovered intervals (recovery_event_count,
  CD_HermiteCable_Dyn_Get_Recovery_Diagnostics). The process-wide total
  is read only by the run profiles of the driver and the OpenFAST module,
  so it becomes a figure of the opt-in step profile (prof_n_recover,
  counted while the profile is armed, like the other profile counts;
  a profiled run steps its cables serially).

Process-wide by design and documented as such: the opt-in run profile
(CableDyn_Profile, armed by CABLEDYN_PROFILE in the driver and the
OpenFAST module), the Hermite step profile (prof_*), the C API handle
registry (locked), the OpenFAST instance registry, and the driver's test
hooks and warn-once flag; thread_safe_sources lists each with its reason.

Tests read the per-object counts (the Hermite recovery gates read the
model's diagnostics and check the armed profile's count and its reset);
example outputs are bit-identical.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
driver_profile_failure failed on the ifx release build when the failing
run (three steps of a short deck) took less than half a millisecond: the
profile then prints "total 0.000 s 0.0 %", since the driver gives no
share of a zero total, and the check required 100.0 %. The total row now
reads either a positive share of 100.0 % or exactly 0.000 s and 0.0 %;
any other share still fails (checked against "0.012 s 0.0 %"). The same
row of check_driver_profile.cmake takes the same form. The checks of the
phase rows are unchanged, so a failed run still charges nothing to the
finalisation it never reached.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The static Windows release compiled with /fp:precise, but every other
ifx build kept the Intel default /fp:fast: a plain ifx CMake build (with
or without OpenMP), the core the OpenFAST CMake route builds as an
external project, its adapter target, and the OpenFAST Visual Studio
project. Under /fp:fast the gates that hold two routes to the same bits
fail and subnormal deck values read as zero, as they did in the release
before /fp:precise.

CMakeLists.txt now passes /fp:precise (-fp-model precise off Windows)
to every Fortran compile of an IntelLLVM build, in every configuration;
the static release takes it from there instead of its own flag list.
The OpenFAST CMake patch gives the adapter target the same model, and
every configuration of the Visual Studio project sets
FloatingPointModel="precise". GNU builds are unchanged.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Only the static Windows release compiled with /heap-arrays:1024 (and the
OpenFAST Visual Studio project with HeapArrays="1024"). A non-static ifx
CMake build (/O2 /Qauto -Qiopenmp, the configuration of a plain ifx
build and of the core in the OpenFAST CMake route) kept run-time-sized
arrays and array temporaries on the stack: test_hermite_node_reaction on
the 2835-node mixed IEA-15 MW deck and the fine-mesh deck FINE_A01557 of
cable_statics_matrix stopped with forrtl severe (170), stack overflow,
in the 1 MiB stack of an MSVC-linked program, and passed with a 64 MiB
reserve.

CMakeLists.txt now passes /heap-arrays:1024 (-heap-arrays 1024 off
Windows) to every Fortran compile of an IntelLLVM build, next to the
floating-point model; the static release takes it from there instead of
its own flag list (same flags, the objects unchanged: every example deck
bit-identical). With it both tests pass in the non-static build.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
…on, not v5.0.0-dirty

OpenFAST stamps its version with `git describe --dirty` (the VersionInfo
pre-build step vs-build/CreateGitVersion.bat, and git_describe in
modules/version/CMakeLists.txt). The integration patches modify the pinned
v5.0.0 checkout, so the released openfast.exe called itself
OpenFAST-v5.0.0-dirty.

Both build routes now stamp '<OpenFAST describe>-CableDyn-<version>', e.g.
OpenFAST-v5.0.0-CableDyn-0.3.0. The OpenFAST part is
`git describe --tags --abbrev=8` of the checked-out commit (no --dirty), i.e.
the unpatched base, so a later base bump stays correct; the CableDyn part is
the project version of CMakeLists.txt. A base not described by a release tag
(vX.Y.Z or vX.Y.Z-N-g<hash>) stops the build.

- integrate_openfast_vs_solution.ps1 replaces CreateGitVersion.bat with a
  script that writes the fixed header, and writes the header itself; a rerun
  writes the same bytes.
- New patch 0021 sets the same string in OpenFAST's CMake build.
- build_static_windows.ps1 fails unless `openfast.exe -v` prints exactly
  OpenFAST-<expected> and no "dirty"; openfast_build_gate.ps1 checks the run
  log of the CMake route the same way.
- The release workflow checks out OpenFAST with its history and tags
  (fetch-depth: 0), which `git describe --tags` needs.
- check_release_metadata.py checks that the installation, release and
  integration docs state the identity for the current version; NOTICE lists
  the modified version CMakeLists.txt.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Under /fp:precise ifx does not use its vector maths library, so every
phase cosine, sine and depth exponential of a wave component became one
scalar library call per element; the MinGW-w64 library of gfortran is
slow there as well. CableDyn_WaveMath evaluates them in blocks of plain
IEEE arithmetic that vectorise under any floating-point model: one
Cody-Waite reduction per sine-cosine pair (pi/2 in three parts), Taylor
polynomials through r^17/r^18 and r^13, and 2^n from its bits; phases
beyond 2^20 pi/2 and exponents outside the normal range take the
intrinsic. Explicit-shape arguments keep the blocks vectorised when
inlined. CD_Component_Wave_Kinematics and CD_Sea_Kinematics call them
and keep the sines with the cosines of the elevation pass.

test_wave_math checks the kernels against quadruple precision: within
2.3 ulp (sine, cosine) over |theta| <= 4e4 and 1.1 ulp (exponential)
over -708..709, quadrant boundaries, signed zero, tiny phases, the
subnormal tail and the intrinsic fallback.

One thread, best of five, ifx /fp:precise: chain_two_train_sea -33 %,
chain_torsethaugen_spread -31 %, als_volturnus_line_break_* -14 %,
lazy_wave_vessel_rao and lazy_wave_bend_stiffener -9 %; gfortran:
-21 %, -20 %, -9 %, +0.1 and +1.2 %. Decks without waves are unchanged.

Example A/B (both compilers): 49 of 53 decks identical; the two
lazy-wave vessel decks differ by one unit in the last printed digit
(7e-8 of a tension's scale); the VolturnUS line-break decks diverge
after t = 860 s to 0.15-0.21 of the anchor-2 tension's scale, the same
size as the gfortran-ifx difference of the unchanged code.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
CD_Wave_SinCos and CD_Wave_Exp clamp each argument to the range of their
reduction before evaluating it, and the elements outside that range were
picked for the intrinsic by |theta| > 2^20 pi/2 and x < -708 .OR.
x > 709. A NaN fails both comparisons, and the clamp itself may turn it
into a finite bound (Fortran leaves MIN and MAX of a NaN unspecified;
gfortran returns the other argument), so under gfortran sin(NaN) and
cos(NaN) came back as 6.4e-11 and 1.0 and exp(NaN) as exp(-708) =
3.3e-308. The intrinsics they replace gave NaN, and CD_Sea_Kinematics
does not check its point and time, so a NaN position turned into a
finite elevation and velocity.

The fallback now takes every element that is not inside the range
(.NOT. (ABS(theta) <= THETA_MAX), .NOT. (x >= X_LOW .AND. x <= X_HIGH)),
so a NaN takes the intrinsic and comes back NaN. Finite arguments take
the same path as before: the results are bit-identical.

test_wave_math gate 5: NaN and -Inf phases inside a block of finite
ones, and a NaN exponent, give NaN, the finite elements of the block
unchanged; on the previous kernels it fails (6.42e-11, 1.0, 3.31e-308).

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
CD_Wave_SinCos and CD_Wave_Exp round to an integer as
(y + 1.5*2^52) - 1.5*2^52 and reduce the phase by pi/2 in exact parts.
A value-unsafe floating-point model folds the rounding to y, and the
kernels then return garbage: under the IFX default /fp:fast (a
non-static IFX CMake build, /O2 /Qauto -Qiopenmp, before every IFX build
took /fp:precise) test_wave_math failed its first check, the error
overflowing the printed field; a sweep of 10^6 phases per decade gave
sine and cosine errors of O(1) (4.5e15 ulp of 1) and exp wrong by O(1)
as well (exp(709) = 4.49e307 for 8.22e307). gfortran -Ofast does the
same.

Every IFX build now compiles with /fp:precise (-fp-model precise), so
only a GNU build given -ffast-math or -Ofast in its flags is left:
src/CableDyn_WaveMath.f90 takes -fno-fast-math under gfortran, after
the build's own flags. The GNU objects are byte-identical to those
before (-O2 and -O3).

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
test_wave_math sampled the sine and cosine only over |theta| <= 4e4 and
the quadrant boundaries only against ulp(theta), so a reduction that
failed above 4e4 passed: with its range cut to 1e5 (the intrinsic taking
over, 5.7e6 ulp under MinGW) every check still held. Its ulp of the
exponential came from SPACING, which returns TINY wherever the spacing is
subnormal, so below exp(-672) the errors were divided by up to 2^52 too
much. A 3 MB array temporary for -theta overflowed the 1 MB stack of a
build without heap arrays.

- 400,000 phases over 4e4 < |theta| < 2^20 pi/2: within 3 ulp
  (measured 2.16 and 2.20);
- the double nearest n pi/2 for every 1 <= n < 2^20, where sine or
  cosine falls to 6.2e-19: the error within 3 ulp of the value plus
  |n| 8.5e-32, the part of pi/2 below P1 + P2 + P3 (measured 0.997 of
  that bound; the relative error reaches 2.8e6 ulp of those tiny values,
  an absolute 9e-26 at most);
- the ulp from the exponent of the correctly rounded value, 2^(e-53),
  down to 2^-1074;
- -theta in an allocated array.

With the range cut to 1e5 the new checks fail (beyond 1e6 ulp, the bound
exceeded); the previous test passed it.

The module header and the CHANGELOG entry stated 2.3 ulp over
|theta| <= 4e4; sweeps of 10^6 phases per decade give up to 2.36 ulp
(at theta = -1.108e4), and next to the zeros the bound above. They now
state 2.4 ulp over |theta| <= 2^20 pi/2 and 9e-26 next to a zero. The
kernels are unchanged.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
CableDyn_Close called omp_pause_resource_all(omp_pause_soft) on every
close (since 0.1.0) to join the calling thread's OpenMP pool, so that a
MinGW-w64 libgomp process does not hang at exit on pool threads still
ending. The Intel and LLVM runtimes (libiomp5, libomp) pause the runtime
of the whole process instead: closing one handle paused the OpenMP of
every other handle and of the host, and the first parallel region of
another thread then deadlocked resuming it, spinning on a lock no live
thread held.

Found as eight test_c_api_threads processes of a non-static ifx build
with OpenMP that had spun for two days, then reproduced: the threading
gate hung in its concurrent-Step phase every time (also with a single
stepping thread, without the earlier phases, with Intel's own runtime
swapped in, with affinity and topology detection off); the stepping
thread waited inside CD_Step_System's parallel-region entry after the
main thread had closed its reference handle.

The pause is now taken only when this unit was built by GCC
(COMPILER_VERSION). The non-static ifx OpenMP build passes the gate 20
of 20 with OMP_NUM_THREADS 1 and 4 (it hung 20 of 20); gfortran passes
c_api_threads, _omp32, _stress, _mixed, _exit (the exit-hang gate the
pause exists for), thread_safe_sources and python_package.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T01:43:37.804143Z bc20c71 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35599780 | 📁 Comparing bc20c71 against latest (fd1936d)

  🔍 Preview build  

33 files changed · ± 33 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: bc20c71820

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit 8bbcd4e into dev Nov 3, 2026
21 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the build/release-hardening branch November 3, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant