Skip to content

ENH Add CUDA support for Hilbert transforms - #14164

Open
viranovskaya wants to merge 2 commits into
mne-tools:mainfrom
viranovskaya:perf/cuda-hilbert-current
Open

ENH Add CUDA support for Hilbert transforms#14164
viranovskaya wants to merge 2 commits into
mne-tools:mainfrom
viranovskaya:perf/cuda-hilbert-current

Conversation

@viranovskaya

@viranovskaya viranovskaya commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Related to #13993 and #13994.

This implements the alternative suggested in the discussion: CUDA support in apply_hilbert instead of a second public job-control parameter in annotate_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 allows annotate_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.hilbert for odd and even lengths, zero padding, analytic signals, and envelopes. A regression test covers the full muscle-annotation call.

Local checks:

  • 290 passed, 12 skipped in the filter and artifact-detection test modules
  • ruff check and format
  • ty
  • codespell
  • rstcheck

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.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant