Global-knot spline LSQ with matrix-free CGLS#150
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
570f11a to
29c0fc9
Compare
…ttered_interpolate
construct_splines_1d/2d/3d periodic-wrap coverage with nonzero x_min was deleted by 61a9eae without replacement; restore it as test_periodic_wrap_1d/2d/3d in test_interpolate.f90. cgls_small (cgls_solve_small) had zero production call sites: every *_lsq constructor solves via the rectangular cgls_dense_solve path, never the pre-assembled square normal-equations path cgls_small expects. It also has unused-variable warnings only visible in Debug builds. Remove the module, its test, and CMake registrations.
User description
This PR implements a global-knot, matrix-free CGLS-based least-squares spline fitting pipeline for 1D/2D/3D and batch 1D splines.
Highlights:
[1/9] cd /home/ert/code/libneo/extra/MyMPILib && /home/ert/code/libneo/extra/MyMPILib/Scripts/do_versioning.sh
Versioning MyMPILib...
[2/9] Building Fortran preprocessed extra/MyMPILib/CMakeFiles/MyMPILib.dir/Specific/mpiprovider_module.f90-pp.f90
[3/9] Generating Fortran dyndep file extra/MyMPILib/CMakeFiles/MyMPILib.dir/Fortran.dd
[4/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Specific/mpiprovider_module.f90.o
[5/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Generic/genericWorkunit_module.f90.o
[6/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Generic/initWorkunit_module.f90.o
[7/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Internal/wuMergeWorkunit_module.f90.o
[8/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Internal/wuMergeChunk_module.f90.o
[9/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Internal/wuDataRequester_module.f90.o
[10/15] Building Fortran object extra/MyMPILib/CMakeFiles/MyMPILib.dir/Generic/scheduler_module.f90.o
[11/15] Linking Fortran static library extra/MyMPILib/libMyMPILib.a
[12/15] Building Fortran object test/CMakeFiles/test_mympilib.x.dir/source/derived_scheduler_module.f90.o
[13/15] Linking Fortran executable test/test_arnoldi.x
[14/15] Building Fortran object test/CMakeFiles/test_mympilib.x.dir/source/test_mympilib.f90.o
[15/15] Linking Fortran executable test/test_mympilib.x
cd build && ctest
Test project /home/ert/code/libneo/build
Start 1: test_binsrc
1/44 Test Make MPI optional and minimize dependencies on Fortran version and external libs #1: test_binsrc ....................... Passed 0.01 sec
Start 2: test_boozer_class
2/44 Test Integrate, document and test VMEC interfaces #2: test_boozer_class ................. Passed 0.01 sec
Start 3: test_efit_class
3/44 Test Supply latest version of all magnetic field routine variants #3: test_efit_class ................... Passed 0.01 sec
Start 4: test_geqdsk_tools
4/44 Test Ninjarun: handle Fortran module dependencies #4: test_geqdsk_tools ................. Passed 0.02 sec
Start 5: test_simpson
5/44 Test bdivfree routine: double precision should be changed back to double complex #5: test_simpson ...................... Passed 0.01 sec
Start 6: test_hdf5_tools
6/44 Test Remove aug from repository #6: test_hdf5_tools ................... Passed 2.01 sec
Start 7: test_util
7/44 Test Vmec #7: test_util ......................... Passed 0.01 sec
Start 8: test_cgls_dense
8/44 Test Python VMEC magfie #8: test_cgls_dense ................... Passed 0.01 sec
Start 9: test_cgls_small
9/44 Test Adapting for Marconi Intel configuration #9: test_cgls_small ................... Passed 0.01 sec
Start 10: test_interpolate
10/44 Test Merge changes from magfie #10: test_interpolate .................. Passed 9.06 sec
Start 11: test_batch_interpolate
11/44 Test Move issues from magfie #11: test_batch_interpolate ............ Passed 1.16 sec
Start 12: test_spline_cgls_global
12/44 Test Update build and CI/CD based on magfie #12: test_spline_cgls_global ........... Passed 0.01 sec
Start 13: test_collision_freqs
13/44 Test First eqdsk tests #13: test_collision_freqs .............. Passed 0.01 sec
Start 14: test_transport
14/44 Test extract vacfield (and coil_tools) from MEPHIT #14: test_transport .................... Passed 0.01 sec
Start 15: test_vmec_modules
15/44 Test Consistency check mixes geometric and logical coordinates #15: test_vmec_modules ................. Passed 0.01 sec
Start 16: test_coordinate_systems
16/44 Test Add check for existence of convexwall #16: test_coordinate_systems ........... Passed 0.01 sec
Start 17: test_analytical_circular
17/44 Test Evaluate equilibrium field only if specified #17: test_analytical_circular .......... Passed 0.02 sec
Start 18: test_ascot5_compare
18/44 Test Implement Biot-Savart variant #18: test_ascot5_compare ............... Passed 9.34 sec
Start 19: test_arnoldi_setup
19/44 Test Replace pfile format by mgrid format #19: test_arnoldi_setup ................ Passed 0.22 sec
Start 20: test_arnoldi
20/44 Test Check maybe undefined behavior #20: test_arnoldi ...................... Passed 0.05 sec
Start 21: test_mympilib
21/44 Test Created converter for the conversion between poloidal and toroidal flux lable s_pol and s_tor #21: test_mympilib ..................... Passed 0.05 sec
Start 22: test_system_utility
22/44 Test SPLIME #22: test_system_utility ............... Passed 0.01 sec
Start 23: setup_test_jorek_field
23/44 Test Revised EQDSK class #23: setup_test_jorek_field ............ Passed 0.01 sec
Start 32: test_jorek_field
24/44 Test Add Boozer Fourier transformations #32: test_jorek_field .................. Passed 0.03 sec
Start 33: test_field
25/44 Test Add checks between Fortran and Python EQDSK routines #33: test_field ........................ Passed 0.03 sec
Start 24: cleanup_test_jorek_field
26/44 Test Support CHEASE EQDSK files #24: cleanup_test_jorek_field .......... Passed 0.01 sec
Start 25: test_biotsavart
27/44 Test Support FREEGS EQDSK files #25: test_biotsavart ................... Passed 0.21 sec
Start 26: test_example_field
28/44 Test Updated comments/naming #26: test_example_field ................ Passed 0.01 sec
Start 27: test_biotsavart_field
29/44 Test branch psipol2phitor: Created converter between poloidal and toroidal #27: test_biotsavart_field ............. Passed 0.01 sec
Start 28: test_mesh
30/44 Test Add check for q profile for EQDSK #28: test_mesh ......................... Passed 0.01 sec
Start 29: test_field_mesh
31/44 Test Add routines to convert to harmonics in flux coordinates #29: test_field_mesh ................... Passed 0.01 sec
Start 30: test_polylag_field
32/44 Test Test even order in spline three to five #30: test_polylag_field ................ Passed 0.06 sec
Start 31: test_spline_field
33/44 Test Integration test API #31: test_spline_field ................. Passed 0.27 sec
Start 34: test_stretch_coords
34/44 Test Add splines for covariant B components #34: test_stretch_coords ............... Passed 0.07 sec
Start 35: test_coil_tools_biot_savart
35/44 Test Design MARS interface via OMFIT #35: test_coil_tools_biot_savart ....... Passed 9.04 sec
Start 36: tilted_coil_generate_geometry
36/44 Test Extend EQDSK interface to output B0 #36: tilted_coil_generate_geometry ..... Passed 0.23 sec
Start 37: tilted_coil_fourier_modes
37/44 Test Move all tests that depend on data in /proj/plasma to CODE #37: tilted_coil_fourier_modes ......... Passed 40.29 sec
Start 38: tilted_coil_field_validation
38/44 Test Small workflow changes for development environment #38: tilted_coil_field_validation ...... Passed 4.20 sec
Start 39: test_polylag_5
39/44 Test Activate highest optimization for coil_tools #39: test_polylag_5 .................... Passed 0.01 sec
Start 40: test_poincare
40/44 Test Splime2 #40: test_poincare ..................... Passed 0.02 sec
Start 41: test_odeint_allroutines_context
41/44 Test Fix index errors in 3D splines #41: test_odeint_allroutines_context ... Passed 0.01 sec
Start 42: test_odeint_thread_safety
42/44 Test Add derivatives to splines #42: test_odeint_thread_safety ......... Passed 0.01 sec
Start 43: build_test_golden_record_odeint
43/44 Test 3D splines of second order derivatives #43: build_test_golden_record_odeint ... Passed 0.02 sec
Start 44: test_golden_record_odeint
44/44 Test Improve OpenMP in Biot-Savart code #44: test_golden_record_odeint ......... Passed 0.18 sec
100% tests passed, 0 tests failed out of 44
Label Time Summary:
biot_savart = 9.04 secproc (1 test)
build-helper = 0.02 secproc (1 test)
field = 0.70 secproc (10 tests)
magfie = 53.77 secproc (4 tests)
poincare = 0.02 secproc (1 test)
polylag = 0.01 secproc (1 test)
tilted_coil = 44.72 sec*proc (3 tests)
Total Test time (real) = 76.80 sec (ctest), including new LSQ and CGLS suites.
PR Type
Enhancement
Description
Implement matrix-free CGLS solvers for small and dense systems
cgls_small.f90: Fixed-size solver for normal equations (ISO Fortran 2018)cgls_dense.f90: General dense solver with OpenMP/SIMD optimization and optional weightsAdd global-knot LSQ spline constructors for 1D/2D/3D and batch 1D
Extend test coverage with new CGLS solver tests and LSQ spline validation
Diagram Walkthrough
File Walkthrough
4 files
New small fixed-size CGLS solver moduleNew dense matrix CGLS solver with OpenMP/SIMDAdd LSQ constructors and design matrix builders for 1D/2D/3DAdd batch LSQ constructor and basis unit allocator5 files
New tests for small CGLS solver on SPD matricesNew tests for dense CGLS solver weighted/unweightedAdd LSQ spline tests for 1D/2D/3D scattered and masked domainsAdd batch 1D LSQ scattered data interpolation testNew test for global-knot design matrix CGLS exactness2 files
Register new CGLS solver modules in buildRegister new CGLS and global-knot test executables