Registry / ai-ml / cuda-bindings

cuda-bindings

JSON →
library13.3.1pypypi✓ verified 10d ago

cuda-bindings provides low-level Python wrappers for the NVIDIA CUDA C driver and runtime APIs. It is a core component of the broader NVIDIA 'CUDA Python' initiative, aiming to unify and simplify GPU-accelerated computing in Python. The current version is 13.2.0, with releases often tied to CUDA Toolkit versions and ongoing development to integrate Python as a first-class language in the CUDA ecosystem.

pip install cuda-bindings
INSTALL
IMPORT
SIG · CUDA-BINDINGS
C
cuda-bindings
ai-mlpythonv13.3.1
Install
1.9s avg
Import
Disk
57MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v13.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.9s · import 0.000s · 43MB
57MB installed
● package 57MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cuInit
import cuda
import cuda.cuda as cu

This quickstart demonstrates how to initialize the CUDA driver, query the number of available CUDA devices, and print basic information for each, such as its name and total memory. It leverages the low-level CUDA C APIs exposed by `cuda-bindings`.

import cuda.cuda as cu import cuda.cuda.runtime as rt import ctypes # For C types like c_int, c_size_t # Initialize CUDA Driver API cu.cuInit(0) # Get device count count = ctypes.c_int() cu.cuDeviceGetCount(ctypes.byref(count)) print(f"Found {count.value} CUDA devices.") # Get properties for each device for i in range(count.value): device = cu.CUdevice() cu.cuDeviceGet(ctypes.byref(device), i) name_buffer = ctypes.create_string_buffer(256) cu.cuDeviceGetName(name_buffer, len(name_buffer), device) print(f" Device {i}: {name_buffer.value.decode().strip()}") total_mem = ctypes.c_size_t() cu.cuDeviceTotalMem(ctypes.byref(total_mem), device) print(f" Total Memory: {total_mem.value / (1024**3):.2f} GB")
Debug
Known issues
breakingMismatch between CUDA Toolkit, NVIDIA GPU driver, and `cuda-bindings` versions is a common source of runtime errors, including 'CUDA Driver Version Insufficient', 'No Kernel Image Available', or failure to find CUDA-enabled devices.
fix
Ensure that your installed NVIDIA GPU driver, CUDA Toolkit, and `cuda-bindings` Python package are compatible. Consult the NVIDIA CUDA Python documentation for compatibility matrices.
affects: All versions
gotchaUpdating `cuda-python` (which `cuda-bindings` is a part of) from older versions (e.g., v12.6.2.post1 and below) using `pip install -U cuda-python` might fail.
fix
Perform a clean re-installation by first uninstalling with `pip uninstall -y cuda-python` (or `pip uninstall -y cuda-bindings`) followed by a fresh `pip install cuda-python` (or `pip install cuda-bindings`).
affects: <=12.6.2.post1
gotcha`cuda-bindings` provides direct, low-level access to the CUDA C APIs. This requires explicit memory management, device context handling, and kernel configuration, which can be more complex than higher-level libraries like Numba CUDA or CuPy.
fix
Be prepared to work with C types (e.g., `ctypes`) and manage GPU resources explicitly. For many common scientific computing or deep learning tasks, higher-level libraries might offer a simpler abstraction. Consider `cuda.core` for more Pythonic access to CUDA runtime functionalities if raw C API interaction is not strictly necessary.
affects: All versions
gotchaOut-of-memory (OOM) errors or illegal memory access can occur when dealing with large datasets or complex models, especially on GPUs with limited VRAM, or due to incorrect memory operations within CUDA kernels.
fix
Monitor GPU memory usage (`nvidia-smi`). Reduce batch sizes, optimize memory allocation patterns, and ensure correct buffer sizing and indexing in custom CUDA kernels. Explicitly free unused GPU memory if applicable.
affects: All versions
breakingThe `cuda-python` or `cuda-bindings` package is not installed or not accessible in the current Python environment, leading to a `ModuleNotFoundError` when attempting to import `cuda.cuda`.
fix
Ensure the `cuda-python` package is installed using `pip install cuda-python` (or `pip install cuda-bindings`). If installed, verify that the Python environment (e.g., virtual environment) where the script is run has access to the installed package.
affects: All versions
breakingInstallation of `cuda-bindings` (or `cuda-python`) may fail with 'No matching distribution found' errors, particularly when using newer Python versions (e.g., 3.13) or non-standard operating system/architecture combinations (e.g., Alpine Linux, ARM). Pre-built wheels for `cuda-bindings` are often limited to specific Python versions and common `glibc`-based Linux distributions.
fix
Verify the availability of pre-built wheels for your specific Python version and operating system/architecture on the `cuda-python` PyPI project page. If no wheels are available, consider using a supported Python version or a `glibc`-based Linux distribution. Building `cuda-bindings` from source is generally not supported or recommended due to its low-level nature and tight coupling with CUDA Toolkits.
affects: All versions
Upgrade
Version history
13.3.1latest on PyPI · released May 29, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or later.
cuda toolkitrequiredRequires a system-wide CUDA Toolkit installation compatible with your NVIDIA GPU driver.
Agent activity
11 hits · last 30 days
node
10
Resources
cuda-bindings — pip install cuda-bindings · libregistry