code: def _setup_cuda_fft_resample(n_jobs, W, new_len):
      """Set up CUDA FFT resampling.
  
      Parameters
      ----------
      n_jobs : int | str
          If n_jobs == 'cuda', the function will attempt to set up for CUDA
          FFT resampling.
      W : array
          The filtering function to be used during resampling.
          If n_jobs='cuda', this function will be shortened (since CUDA
          assumes FFTs of real signals are half the length of the signal)
          and turned into a gpuarray.
      new_len : int
          The size of the array following resampling.
  
      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 resample.
  
      Notes
      -----
      This function is designed to be used with fft_resample().
      """
      cuda_dict = dict(use_cuda=False, rfft=rfft, irfft=irfft)
      rfft_len_x = len(W) // 2 + 1
      # fold the window onto inself (should be symmetric) and truncate
      W = W.copy()
      W[1:rfft_len_x] = (
          W[1:rfft_len_x] + W[::-1][: rfft_len_x - 1]
      ) / 2.0
      W = W[:rfft_len_x]
      if isinstance(n_jobs, str):
          _check_option("n_jobs", n_jobs, ("cuda",))
          n_jobs = 1
          init_cuda()
          if _cuda_capable:
              try:
                  import cupy
  
                  # do the IFFT normalization now so we don't have to later
                  W = cupy.array(W)
                  logger.info("Using CUDA for FFT resampling")
              except Exception:
                  logger.info(
                      "CUDA not used, could not instantiate memory "
                      "(arrays may be too large), falling back to "
                      "n_jobs=None"
                  )
              else:
                  cuda_dict.update(
                      use_cuda=True,
                      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"
              )
      cuda_dict["W"] = W
      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 7 for calling a global function with example usage: _setup_cuda_fft_resample(n_jobs, W, new_len) and returns: n_jobs,  cuda_dict