NVIDIA cuFFT

12.2.0.37 · active · verified Thu Apr 09

The `nvidia-cufft` package provides the NVIDIA CUDA Fast Fourier Transform (cuFFT) native runtime libraries for Python environments. It is not a Python API itself, but rather a low-level dependency for other Python libraries (like CuPy, PyTorch, or TensorFlow) that leverage cuFFT for GPU-accelerated FFT computations. The current version is 12.2.0.37, and new versions are typically released in conjunction with NVIDIA CUDA Toolkit updates.

Warnings

Install

Quickstart

This quickstart demonstrates how a higher-level library like CuPy leverages `nvidia-cufft` for GPU-accelerated FFTs. The `nvidia-cufft` package itself provides the native shared libraries but no direct Python API. Installation of `cupy` is required to run this example.

import cupy as cp
import cupy.fft as cufft

# Ensure CUDA is available and nvidia-cufft binaries are usable by CuPy
if not cp.cuda.is_available():
    print("CUDA is not available. CuPy cannot use cuFFT.")
else:
    print(f"CuPy version: {cp.__version__}")
    print(f"CUDA driver version: {cp.cuda.runtime.getDriverVersion()}")
    print(f"CUDA runtime version: {cp.cuda.runtime.get_version()}")

    # Example: Perform a 1D FFT on the GPU using CuPy
    a_h = cp.arange(10, dtype=cp.float32) # Host array (CPU)
    a_d = cp.asarray(a_h) # Transfer to Device (GPU)
    
    print(f"\nOriginal array on GPU: {a_d}")
    
    # Perform FFT on GPU using CuPy's wrapper for cuFFT
    fft_result_d = cufft.fft(a_d)
    
    print(f"FFT result on GPU: {fft_result_d}")
    
    print("\nNote: The `nvidia-cufft` package provides the underlying native")
    print("libraries that enable CuPy's GPU FFT functions to work. This")
    print("package itself does not expose direct Python imports or APIs.")

view raw JSON →