code: def _setup_cuda_fft_multiply_repeated(
      n_jobs, h, n_fft, kind="FFT FIR filtering"
  ):
      """Set up repeated CUDA FFT multiplication with a given filter.
  
      Parameters
      ----------
      n_jobs : int | str
          If ``n_jobs='cuda'``, the function will attempt to set up for CUDA
          FFT multiplication.
      h : array
          The filtering function that will be used repeatedly.
      n_fft : int
          The number of points in the FFT.
      kind : str
          The kind to report to the user.
  
      Returns
      -------
      n_jobs : int
          Sets n_jobs = 1 if n_jobs == 'cuda' was passed in, otherwise
          original n_jobs is passed.
      cuda_dict : dict
          Dictionary with the following CUDA-related variables:
              use_cuda : bool
                  Whether CUDA should be used.
              fft_plan : instance of FFTPlan
                  FFT plan to use in calculating the FFT.
              ifft_plan : instance of FFTPlan
                  FFT plan to use in calculating the IFFT.
              x_fft : instance of gpuarray
                  Empty allocated GPU space for storing the result of the
                  frequency-domain multiplication.
              x : instance of gpuarray
                  Empty allocated GPU space for the data to filter.
      h_fft : array | instance of gpuarray
          This will either be a gpuarray (if CUDA enabled) or ndarray.
  
      Notes
      -----
      This function is designed to be used with fft_multiply_repeated().
      """
      cuda_dict = dict(
          n_fft=n_fft, rfft=rfft, irfft=irfft, h_fft=rfft(h, n=n_fft)
      )
      if isinstance(n_jobs, str):
          _check_option("n_jobs", n_jobs, ("cuda",))
          n_jobs = 1
          init_cuda()
          if _cuda_capable:
              import cupy
  
              try:
                  # do the IFFT normalization now so we don't have to later
                  h_fft = cupy.array(cuda_dict["h_fft"])
                  logger.info("Using CUDA for %s" % kind)
              except Exception as exp:
                  logger.info(
                      "CUDA not used, could not instantiate memory "
                      '(arrays may be too large: "%s"), falling back to '
                      "n_jobs=None" % str(exp)
                  )
              cuda_dict.update(
                  h_fft=h_fft,
                  rfft=_cuda_upload_rfft,
                  irfft=_cuda_irfft_get,
              )
          else:
              logger.info(
                  "CUDA not used, CUDA could not be initialized, "
                  "falling back to n_jobs=None"
              )
      return n_jobs, cuda_dict
  
file_path: mne-python/mne/cuda.py
imports: import numpy
  from scipy.fft import irfft, rfft
  from .utils import _check_option, _explain_exception, fill_doc, get_config, logger, sizeof_fmt, verbose, warn
label_desc: Use image node_id 5 for calling a global function with example usage: _setup_cuda_fft_multiply_repeated(n_jobs, h, n_fft, kind) and returns: n_jobs,  cuda_dict