Add Numba JIT acceleration for KS computation (~2-3× end-to-end speedup)#1
Open
TorbenOestergaard wants to merge 1 commit intomarkus-schaffer:mainfrom
Open
Add Numba JIT acceleration for KS computation (~2-3× end-to-end speedup)#1TorbenOestergaard wants to merge 1 commit intomarkus-schaffer:mainfrom
TorbenOestergaard wants to merge 1 commit intomarkus-schaffer:mainfrom
Conversation
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.
Description:
This PR adds optional Numba JIT compilation to the inner loops of SAtom, significantly reducing computation time for large datasets.
Changes
_core.py
YtempSorted(list of augmented arrays with 1-based MATLAB indices) with YsortedIdx — a clean (nOut, N) array of 0-based sort indices, used by both code pathspyproject.toml
pytest,pandas,openpyxlfrom runtime dependencies (not required by satom)[fast]optional extra:pip install satom[fast]installs Numba[dev]extrasPerformance
Tested on the Ishigami-Homma function (3 inputs, 1 output, N=500) and the Viborg dataset (10 inputs, 3 outputs, N=5000):
Benchmark NumPy Numba Speedup
Isolated KS row (Ishigami). ~500 µs. ~31 µs. 16×
End-to-end SAtom (Viborg, J=1000). ~0.9 s. ~0.3–0.5 s. 2–3×
The first call incurs a one-time JIT compilation cost (~1–2 s); subsequent calls use the cached compilation.
Backward compatibility