code: def test_cuda_fir():
      """Test CUDA-based filtering."""
      # Using `n_jobs='cuda'` on a non-CUDA system should be fine,
      # as it should fall back to using n_jobs=None.
      rng = np.random.RandomState(0)
      sfreq = 500
      sig_len_secs = 20
      a = rng.randn(sig_len_secs * sfreq)
      kwargs = dict(fir_design="firwin")
  
      with catch_logging() as log_file:
          for fl in ["auto", "10s", 2048]:
              args = [a, sfreq, 4, 8, None, fl, 1.0, 1.0]
              bp = filter_data(*args, **kwargs)
              bp_c = filter_data(
                  *args, n_jobs="cuda", verbose="info", **kwargs
              )
              assert_array_almost_equal(bp, bp_c, 12)
  
              args = [a, sfreq, 8 + 1.0, 4 - 1.0, None, fl, 1.0, 1.0]
              bs = filter_data(*args, **kwargs)
              bs_c = filter_data(
                  *args, n_jobs="cuda", verbose="info", **kwargs
              )
              assert_array_almost_equal(bs, bs_c, 12)
  
              args = [a, sfreq, None, 8, None, fl, 1.0]
              lp = filter_data(*args, **kwargs)
              lp_c = filter_data(
                  *args, n_jobs="cuda", verbose="info", **kwargs
              )
              assert_array_almost_equal(lp, lp_c, 12)
  
              args = [lp, sfreq, 4, None, None, fl, 1.0]
              hp = filter_data(*args, **kwargs)
              hp_c = filter_data(
                  *args, n_jobs="cuda", verbose="info", **kwargs
              )
              assert_array_almost_equal(hp, hp_c, 12)
  
      # check to make sure we actually used CUDA
      out = log_file.getvalue().split("\n")[:-1]
      # triage based on whether or not we actually expected to use CUDA
      from mne.cuda import _cuda_capable  # allow above funs to set it
  
      tot = 12 if _cuda_capable else 0
      assert (
          sum(["Using CUDA for FFT FIR filtering" in o for o in out])
          == tot
      )
      if not _cuda_capable:
          pytest.skip("CUDA not enabled")
  
imports: import numpy
  import pytest
  from numpy.fft import fft, fftfreq
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_array_less
  from scipy.signal import butter, freqz, sosfreqz
  from scipy.signal import resample
  from mne import Epochs, create_info
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT
  from mne.filter import _length_factors, _overlap_add_filter, _resample_stim_channels, _smart_pad, construct_iir_filter, create_filter, design_mne_c_filter, detrend, estimate_ringing_samples, filter_data, notch_filter, resample
  from mne.io import RawArray, read_raw_fif
  from mne.utils import catch_logging, requires_mne, run_subprocess, sum_squared
label_desc: Use image node_id 16 for calling a global function with example usage: test_cuda_fir() without return types