ENH Add CUDA support for Hilbert transforms - #14164
Open
viranovskaya wants to merge 2 commits into
Open
Conversation
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.
Related to #13993 and #13994.
This implements the alternative suggested in the discussion: CUDA support in
apply_hilbertinstead of a second public job-control parameter inannotate_muscle_zscore.When
n_jobs="cuda"is requested, the analytic signal is computed with CuPy FFT and transferred back to NumPy. If CUDA cannot be initialized, the existing CPU implementation is used with one job. This allowsannotate_muscle_zscore(..., n_jobs="cuda")to use the same setting for filtering and the Hilbert transform without exposing an implementation-specific parameter.The numerical tests compare the FFT implementation with
scipy.signal.hilbertfor odd and even lengths, zero padding, analytic signals, and envelopes. A regression test covers the full muscle-annotation call.Local checks:
This was tested on a machine without CUDA hardware. The CPU fallback and numerical implementation are covered locally, but the actual CuPy device path still needs CUDA-backed verification.