P5 drop-gsl: remove GSL/FGSL now that fortnum backs every module#99
Open
krystophny wants to merge 7 commits into
Open
P5 drop-gsl: remove GSL/FGSL now that fortnum backs every module#99krystophny wants to merge 7 commits into
krystophny wants to merge 7 commits into
Conversation
Declare fortnum once (guarded by NOT TARGET fortnum): prefer a local $CODE/fortnum checkout, otherwise FetchContent the pinned revision 4c560b0 over https so CI can clone the public repo. Link the common library against fortnum alongside the existing GSL/FGSL backends. This adds the new dependency before any call site migrates to it and removes nothing yet, so the build and physics are unchanged: GSL still backs gsl_specialfunctions_mod, gsl_integration_routines_mod, and gsl_bspline_routines_mod.
This was referenced Jun 14, 2026
Replace the FGSL backend of besselk(n,z) with fortnum bessel_kn. The module and public function name stay identical, so collop_compute.f90 (orders 0, 1, 2) compiles unchanged. The kind alias moves from fgsl_double to iso_fortran_env real64 (wp).
…sl_roots Re-express the QUADPACK-pattern 1D integrators on fortnum: fint1d_qag/qags/qagp/qagiu map to integrate_qag/qags/qagp/qagiu, and fint1d_cquad runs on the adaptive QAGS path (Wynn-epsilon extrapolation covers the endpoint singularities CQUAD targets). The user integrand reaches fortnum through a host-associated panel(x, ctx) wrapper, and fortnum_status_t feeds the existing disp_gsl_integration_error accumulator. The public interface (module, generic names, result(2) value/abserr) is preserved so collop_compute.f90 and both collop_definitions.f90 compile unchanged; the internal kind alias is renamed dp -> wp to avoid clashing with the callers' nrtype dp on use-association. gsl_roots_routines_mod has no call sites in the tree and is removed together with its build-list entry.
Replace the FGSL B-spline workspace with the caller-owned fortnum bspline_workspace_t. init_bspline/set_bspline_knots map to bspline_init/bspline_set_knots; basis values come from bspline_eval_basis and the all-orders derivative table from bspline_eval_deriv. The public interface is preserved (init_bspline, set_bspline_knots, bspline_eval, bspline_deriv_eval, the taylorExpansion flag, and the fgsl_double real kind now aliased to real64) so collop_bspline.f90 compiles unchanged. The dby/dby_end arrays are reindexed 0:order to match fortnum's (0:nderiv, ncoef) layout; the Taylor extrapolation above the last breakpoint stays in NEO-2.
No module uses GSL or FGSL anymore: gsl_specialfunctions_mod, gsl_integration_routines_mod, and gsl_bspline_routines_mod all run on fortnum, and gsl_roots_routines_mod is gone. Remove the FGSL ExternalProject (cmake/fgsl.cmake), find_package(GSL), the FGSL include and link paths, and the add_dependencies(common FGSL) edge. fortnum is now the sole numerical backend of the common library.
12bf7e3 to
a24df49
Compare
d949869 to
dfdd5b6
Compare
This was referenced Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge order
#95 -> #96 -> #97 -> #98 -> #99
Each PR now targets main on its own, so its diff is cumulative (p1 + .. + pN) against main and the PRs share code. Merge them in the sequence above. Once a predecessor merges into main, the next PR's diff shrinks to its own increment.
Final PR of the reordered fortnum migration stack. Base: P4 (#98).
No module uses GSL or FGSL anymore. Removes the FGSL ExternalProject (cmake/fgsl.cmake), find_package(GSL), the FGSL include and link paths, and the add_dependencies(common FGSL) edge. fortnum is the sole numerical backend of the common library.
Verification
Full reordered stack tip built locally with
$CODEunset (https FetchContent of fortnum 4c560b0, no GSL): neo_2_par.x and neo_2_ql.x both link; ctest 3/3 pass.CI status: expected backend-swap red, resolves on merge
The run-golden-record check is red, and that is the expected backend-swap signal.
The collision-operator integrals now run on fortnum instead of GSL/FGSL. The lorentz golden record compares this build against a reference NEO-2 still linked to GSL: the latest stable release (rough check) and a fresh main build (exact check). Both references differ from the fortnum build at the numerical-library level:
These exceed the lorentz tolerance (TOL=1e-14), so compare_h5.py reports the two as not the same and the job fails. The difference is the fortnum-vs-GSL result of the same integrals, not a regression. The build itself is clean: fortnum is fetched and linked, both neo_2_par.x and neo_2_ql.x compile, and the unit tests pass.
The golden record regenerates from main once the migration lands. Merge in the stated order; when this PR's predecessor reaches main, the exact-check reference becomes the fortnum build and the comparison closes. Do not loosen the tolerance.
Note: fortnum pin updated to current main (92de6e9) after a fortnum history rewrite; old shas no longer resolve.