Epic: Cross-platform native-Fortran + CPU-scaling + CUDA/decomposition benchmark - #94
Merged
Merged
Conversation
* Add native-fortran backend to dimsweep harness * Make native amica build portable (gfortran, no MKL) * Document Phase 1 build + cross-platform validation * Address PR review: guard coverage, loud failures, doc fixes
* Add CPU core-count scaling sweep (--threads) * Suppress AMICA_NumPy verbose output in sweep * Add Phase 2 CPU-scaling findings * Address review: numpy divergence, thread leak, report visibility * Add complete f64+f32 cross-platform scaling findings
* Add Phase 3 decomposition-equivalence harness * Add IC topomap figure + montage to decompose harness * Order IC topomaps by variance (EEGLAB); square equivalence matrix * Add Phase 3 decomposition-equivalence findings + figures * Organize Phase 3 figures under benchmarks/figures/ * Address review: de-sphere topomap scalp maps, n<2 guard, doc fixes
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
+ Coverage 79.03% 79.44% +0.40%
==========================================
Files 14 14
Lines 1975 1975
Branches 337 337
==========================================
+ Hits 1561 1569 +8
+ Misses 310 301 -9
- Partials 104 105 +1 🚀 New features to boost your workflow:
|
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
Cross-platform result + performance benchmark of every AMICA backend, extending the Phase B
dimension-sweep harness (#77) with native Fortran, CPU core-scaling, and full-decomposition
cross-backend equivalence. Answers how the native reference and multi-core CPU compare to the
GPU backends, where the crossovers are, and -- the headline -- whether every backend recovers
the same decomposition.
Closes #84
Phases (each individually reviewed + merged into this epic branch)
native-fortran-f64backend in thedimsweep harness, timed via amica's own per-iteration stamps; a cross-platform gfortran+OpenMP
build (
benchmarks/fortran/) that compiles on macOS arm64 and Linux x86_64 without MKL. Thebuild-portability fixes were also upstreamed to sccn/amica (PR Return best iterate from AMICATorchNG.fit (#51) #53, closing their Implement save/load persistence for AMICATorchNG #44).
--threadssweep (torch-cpu / numpy / native-fortran)x channels x f64/f32 on both machines. Native Fortran is the only CPU backend that scales with
cores and beats the RTX 4090 f64; torch-cpu peaks ~8 cores then regresses; MLX is the
efficiency winner (~33 ms/it, matches a 4090 and a 32-core CPU on a laptop GPU); f32 verified
correct (LL matches f64).
Hungarian-matched ICs + EEGLAB-style variance-ordered, de-sphered IC topomaps. Every
torch/MLX backend recovers an identical decomposition (f32==f64==CPU==CUDA==MPS==MLX at
corr 1.000); native Fortran is equivalent where the problem is well-determined (0.997 at
k=574), differing only on weakly-determined k=30 components (a clock-seed local optimum).
Equivalence tracks the data-adequacy k factor.
Result
pyAMICA is a device- and precision-invariant, EEGLAB-AMICA-equivalent decomposition, with MLX
the standout for efficiency on Apple hardware and native Fortran the fastest CPU reference.
Findings + figures in
.context/issue-84/phase{1,2,3}_*.Test plan
for the adapters/matchers run in CI.
Follow-ups filed
#90 data-size/k sweep (full 747k recording), #91 spatially-distributed channel subsets,
#92 drop-in EEGLAB output/convention parity.