{"id":1590,"library":"nvidia-cufft","title":"NVIDIA cuFFT","description":"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.","status":"active","version":"12.2.0.37","language":"en","source_language":"en","source_url":"https://developer.nvidia.com/cuda-toolkit","tags":["GPU","CUDA","FFT","scientific-computing","runtime","deep-learning"],"install":[{"cmd":"pip install nvidia-cufft","lang":"bash","label":"Install nvidia-cufft"}],"dependencies":[{"reason":"Commonly used Python library that leverages nvidia-cufft for GPU-accelerated FFTs. Used in quickstart example.","package":"cupy","optional":true}],"imports":[],"quickstart":{"code":"import cupy as cp\nimport cupy.fft as cufft\n\n# Ensure CUDA is available and nvidia-cufft binaries are usable by CuPy\nif not cp.cuda.is_available():\n    print(\"CUDA is not available. CuPy cannot use cuFFT.\")\nelse:\n    print(f\"CuPy version: {cp.__version__}\")\n    print(f\"CUDA driver version: {cp.cuda.runtime.getDriverVersion()}\")\n    print(f\"CUDA runtime version: {cp.cuda.runtime.get_version()}\")\n\n    # Example: Perform a 1D FFT on the GPU using CuPy\n    a_h = cp.arange(10, dtype=cp.float32) # Host array (CPU)\n    a_d = cp.asarray(a_h) # Transfer to Device (GPU)\n    \n    print(f\"\\nOriginal array on GPU: {a_d}\")\n    \n    # Perform FFT on GPU using CuPy's wrapper for cuFFT\n    fft_result_d = cufft.fft(a_d)\n    \n    print(f\"FFT result on GPU: {fft_result_d}\")\n    \n    print(\"\\nNote: The `nvidia-cufft` package provides the underlying native\")\n    print(\"libraries that enable CuPy's GPU FFT functions to work. This\")\n    print(\"package itself does not expose direct Python imports or APIs.\")","lang":"python","description":"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."},"warnings":[{"fix":"To use cuFFT from Python, install a wrapper library such as `cupy` or use the relevant modules within `pytorch` or `tensorflow` that internally call cuFFT.","message":"The `nvidia-cufft` package does NOT expose a direct Python API for cuFFT functions. It provides only the native runtime libraries (e.g., `.so` or `.dll` files) that other Python libraries (like CuPy, PyTorch, or TensorFlow) link against to offer GPU-accelerated FFT capabilities.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the compatibility matrix for your specific CUDA Toolkit version and ensure all related packages are aligned. Often, installing CUDA-enabled libraries like `cupy-cudaXX` (where XX is CUDA version) might implicitly handle this.","message":"Ensure the `nvidia-cufft` version is compatible with your installed NVIDIA CUDA Toolkit and driver version, as well as the CUDA versions targeted by other GPU-accelerated Python libraries (e.g., CuPy, PyTorch). Mismatches can lead to runtime errors, crashes, or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If experiencing cuFFT-related errors, verify `nvidia-cufft` is installed (`pip show nvidia-cufft`) and its version is appropriate for your setup. Avoid manual installation if `pip install cupy` or similar commands are already successfully installing it.","message":"For most users, `nvidia-cufft` is installed as an indirect dependency when installing other GPU-accelerated Python libraries (e.g., `cupy`). Manual installation is usually not necessary unless troubleshooting specific environment setups or dependency issues.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}