Skip to content

annotate_muscle_zscore does not work with n_jobs = 'cuda' #13993

Description

@todorovdi

Description of the problem

If one runs annotate_muscle_zscore with n_jobs = 'cuda' it fails because inside it uses the same n_jobs argument value for filtering and for apply_hibert. But apply_hibert can only work in normal multiprocessing mode. Though filtering is still good to do on CUDA, when it is available. I tried on mne 1.12.1

I propose an easy fix:
add n_jobs_hilbert=None as argument of annotate_muscle_zscore and then inside just

raw_copy.filter(
    filter_freq[0],
    filter_freq[1],
    fir_design="firwin",
    pad="reflect_limited",
    n_jobs=n_jobs,
)
raw_copy.apply_hilbert(envelope=True, n_jobs=n_jobs_hilbert)

Steps to reproduce

call annotate_muscle_zscore with argument n_jobs = 'cuda'

Link to data

should be reproducible on any data

Expected results

the function runs normally and returns the muscle annotations

Actual results

exception from within apply_hilbert is thrown saying that 'integer or None expected, but got 'str'

Additional information

should be reproducible on any system with CUDA available

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions