Decompose monolithic neo core into independent CMake sub-targets#275
Draft
krystophny wants to merge 9 commits intomainfrom
Draft
Decompose monolithic neo core into independent CMake sub-targets#275krystophny wants to merge 9 commits intomainfrom
krystophny wants to merge 9 commits intomainfrom
Conversation
2 tasks
795f2dd to
e78207e
Compare
The PYTHONPATH additions were a drive-by fix unrelated to removing MyMPILib. Keep this PR focused on the MPI dependency removal only.
Move libneo_kinds, math_constants, util, binsrc, plag_coeff, arnoldi, rusage_type, system_utility, simpson_integration, local_rusage.c into src/util/ with own CMakeLists.txt defining the neo_util static library. Update CMakeSources.in to remove these files and link neo_util. Add neo_util dependency to magfie, species, collisions, transport sub-targets that use libneo_kinds/math_constants directly. Ref: #274
Move nctools_module.f90 into src/nctools/ with own CMakeLists.txt. Pure NetCDF wrapper with no internal libneo dependencies (Tier 0). Ref: #274
Create LIBNEO::vmec_support (Tier 1): VMEC I/O, spline construction,
and data modules (new_vmec_stuff_mod, vector_potentail_mod, etc.).
Depends on interpolate, nctools, util, and NetCDF.
Create LIBNEO::coordinates (Tier 1): all 13 coordinate system files.
Depends on vmec_support, interpolate, nctools, util, and NetCDF.
Move magfie_vmec.f90 and geqdsk_tools.f90 from CMakeSources.in into
the magfie sub-target (they already lived under src/magfie/).
Narrow species dependency from neo to neo_util (only needs
math_constants). Narrow collision_freqs dependency similarly.
The neo aggregate target now contains only poincare.f90 and links
all sub-targets. CMake tier structure:
Tier 0: util, nctools, interpolate, odeint, polylag, hdf5_tools,
neo_field, contrib
Tier 1: vmec_support, coordinates
Tier 2+: neo (aggregate), species, collision_freqs, transport,
magfie
Ref: #274, #258
geqdsk_tools.f90 is a standalone EQDSK parser used by geoflux_coordinates.f90. Placing it in magfie created a circular dependency (coordinates -> magfie -> neo -> coordinates). Move it to the coordinates sub-target where its consumer lives. Add coordinates as a dependency of magfie (for the standardise_geqdsk executable which uses geqdsk_tools transitively). Ref: #274
gfortran on Apple Silicon resolves -march=native to apple-m3 which it does not recognize. Use -mcpu=native on ARM targets instead, which is the correct flag for aarch64 gfortran.
When libneo is used as a subproject via FetchContent, the NetCDF link directories from DetectDependencies.cmake may not propagate. Add nf-config fallback to nctools so it can find NetCDF independently. Remove duplicate NetCDF links from vmec_support and coordinates since they get NetCDF transitively via nctools (PUBLIC link).
e78207e to
cc183b8
Compare
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.
Summary
LIBNEO::utilsub-target (Tier 0): libneo_kinds, math_constants, binsrc, plag_coeff, arnoldi, system_utility, etc.LIBNEO::nctoolssub-target (Tier 0): standalone NetCDF wrapperLIBNEO::vmec_supportsub-target (Tier 1): VMEC I/O, spline construction, data modulesLIBNEO::coordinatessub-target (Tier 1): coordinate system framework + geqdsk_toolsjorek_field.f90fromneo_fieldlibrary, decoupling it from HDF5 (Remove jorek_field.f90 from neo_field #267)magfie_vmec.f90from neo core into magfie sub-targetneotoneo_utilpoincare.f90and links all sub-targetsBuilds on the MyMPILib removal branch (#259).
Test evidence
libneo standalone
NEO-2 (on dep-audit/wave-01-remove-mympilib)
SIMPLE (on dep-audit/decompose-neo-core, itpplasma/SIMPLE PR pending)
One pre-existing test failure (missing netcdf.h for C test), not decomposition-related.
KAMEL
MEPHIT
Pre-existing build failure on main (odeint_mod API incompatibility), not caused by this PR.
tiago
Pre-existing build failure on main (-march=native on Apple Silicon), does not use local libneo.
NEO-RT
Standalone mode, does not use libneo.
Downstream PRs
dep-audit/decompose-neo-core(f90wrap path update)Tier structure
Closes #267. Ref: #274, #258, #269.