nabu.processing.fft_cuda module¶
- class nabu.processing.fft_cuda.SKCUFFT(shape, dtype, r2c=True, axes=None, normalize='rescale', **backend_options)[source]¶
Bases:
_BaseFFT
Base class for Fast Fourier Transform (FFT).
- Parameters:
shape (list of int) – Shape of the input data
dtype (str or numpy.dtype) – Data type of the input data
r2c (bool, optional) – Whether to use real-to-complex transform for real-valued input. Default is True.
axes (list of int, optional) –
- Axes along which FFT is computed.
For 2D transform: axes=(1,0)
For batched 1D transform of 2D image: axes=(-1,)
normalize (str, optional) –
- Whether to normalize FFT and IFFT. Possible values are:
”rescale”: in this case, Fourier data is divided by “N” before IFFT, so that IFFT(FFT(data)) = data. This corresponds to numpy norm=None i.e norm=”backward”.
”ortho”: in this case, FFT and IFFT are adjoint of eachother, the transform is unitary. Both FFT and IFFT are scaled with 1/sqrt(N).
”none”: no normalizatio is done : IFFT(FFT(data)) = data*N
backend_options (dict, optional) – Parameters to pass to CudaProcessing or OpenCLProcessing class.
- implem = 'skcuda'¶
- backend = 'cuda'¶
- ProcessingCls¶
alias of
CudaProcessing
- class nabu.processing.fft_cuda.VKCUFFT(shape, dtype, r2c=True, axes=None, normalize='rescale', **backend_options)[source]¶
Bases:
_BaseVKFFT
Cuda FFT, using VKFFT backend
Base class for Fast Fourier Transform (FFT).
- Parameters:
shape (list of int) – Shape of the input data
dtype (str or numpy.dtype) – Data type of the input data
r2c (bool, optional) – Whether to use real-to-complex transform for real-valued input. Default is True.
axes (list of int, optional) –
- Axes along which FFT is computed.
For 2D transform: axes=(1,0)
For batched 1D transform of 2D image: axes=(-1,)
normalize (str, optional) –
- Whether to normalize FFT and IFFT. Possible values are:
”rescale”: in this case, Fourier data is divided by “N” before IFFT, so that IFFT(FFT(data)) = data. This corresponds to numpy norm=None i.e norm=”backward”.
”ortho”: in this case, FFT and IFFT are adjoint of eachother, the transform is unitary. Both FFT and IFFT are scaled with 1/sqrt(N).
”none”: no normalizatio is done : IFFT(FFT(data)) = data*N
backend_options (dict, optional) – Parameters to pass to CudaProcessing or OpenCLProcessing class.
- implem = 'vkfft'¶
- backend = 'cuda'¶
- ProcessingCls¶
alias of
CudaProcessing
- vkffs_cls¶
alias of
VkFFTApp
- nabu.processing.fft_cuda.has_vkfft(safe=True)[source]¶
Determine whether pyvkfft is available. For Cuda GPUs, vkfft relies on nvrtc which supports a narrow range of Cuda devices. Unfortunately, it’s not possible to determine whether vkfft is available before creating a Cuda context. So we create a process (from scratch, i.e no fork), do the test within, and exit. This function cannot be tested from a notebook/console, a proper entry point has to be created (if __name__ == “__main__”).