Registry / ai-ml / nvidia-cublas-cu11

nvidia-cublas-cu11

JSON →
library11.11.3.6pypypi✓ verified 23d ago

The `nvidia-cublas-cu11` package provides the native CUBLAS runtime libraries for NVIDIA GPUs, specifically for CUDA 11 environments. CUBLAS is NVIDIA's highly optimized implementation of BLAS (Basic Linear Algebra Subprograms) which is critical for accelerating AI and HPC workloads. This package allows Python environments to access GPU computational resources for linear algebra operations, typically as a dependency for higher-level frameworks like PyTorch, TensorFlow, or through wrappers like Numba. The current version is 11.11.3.6, with releases generally aligned with CUDA Toolkit updates and subsequent patch releases.

pip install nvidia-cublas-cu11
INSTALL
IMPORT
SIG · NVIDIA-CUBLAS-CU11
N
nvidia-cublas-cu11
ai-mlpythonv11.11.3.6
Install
10.0s avg
Import
Disk
655MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v11.11.3.6 · 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 10.0s · import 0.000s · 658MB
655MB installed
● package 655MB
Code
Verified usage

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

nvidia
import nvidia
import numba.cuda

This quickstart demonstrates how to utilize GPU-accelerated linear algebra through Numba, which in turn leverages the underlying CUBLAS libraries provided by `nvidia-cublas-cu11`. It performs a basic matrix multiplication, highlighting the necessary steps for device memory allocation, kernel execution, and result retrieval. Ensure you have Numba installed (`pip install numba`) and a compatible NVIDIA GPU and CUDA Toolkit. This example uses a custom kernel but Numba can also directly call CUBLAS functions for some operations.

import numpy as np from numba import cuda import math @cuda.jit def matmul(A, B, C): # Perform matrix multiplication of C = A * B row, col = cuda.grid(2) if row < C.shape[0] and col < C.shape[1]: tmp = 0. for k in range(A.shape[1]): tmp += A[row, k] * B[k, col] C[row, col] = tmp # Example usage N = 256 A_host = np.random.rand(N, N).astype(np.float32) B_host = np.random.rand(N, N).astype(np.float32) C_host = np.zeros((N, N), dtype=np.float32) # Allocate device memory A_device = cuda.to_device(A_host) B_device = cuda.to_device(B_host) C_device = cuda.to_device(C_host) # Configure the blocks and threads threads_per_block = (16, 16) blocks_per_grid_x = int(math.ceil(A_host.shape[0] / threads_per_block[0])) blocks_per_grid_y = int(math.ceil(B_host.shape[1] / threads_per_block[1])) blocks_per_grid = (blocks_per_grid_x, blocks_per_grid_y) # Launch the kernel matmul[blocks_per_grid, threads_per_block](A_device, B_device, C_device) # Copy the result back to the host C_result = C_device.copy_to_host() print('Matrix multiplication completed on GPU (via Numba wrapping CUBLAS).') # For verification (optional, requires higher-level libraries to implicitly use CUBLAS or direct numpy CPU op) # C_numpy = np.dot(A_host, B_host) # print(f"Max absolute difference: {np.max(np.abs(C_result - C_numpy))}") # Should be very small
Debug
Known issues
breakingMismatching `nvidia-cublas-cu11` versions with your installed NVIDIA CUDA Toolkit can lead to runtime errors, undefined behavior, or application crashes. CUBLAS versions are tightly coupled with CUDA versions.
fix
Always ensure the installed `nvidia-cublas-cu11` package version (indicated by `cu11` in the name for CUDA 11 compatibility) matches your system's CUDA Toolkit version. Consult NVIDIA's documentation for compatibility matrices.
affects: All versions
gotchaThis package primarily provides native shared libraries (`.so`, `.dll`) and is not intended for direct Python import or interaction. Users typically access CUBLAS functionality indirectly via higher-level Python libraries like Numba, PyTorch, or TensorFlow, which bind to these underlying C/C++ libraries. Attempting `import cublas` will fail.
fix
Utilize frameworks like Numba (`from numba import cuda`), PyTorch (`import torch`), or TensorFlow (`import tensorflow`) to leverage GPU acceleration. These libraries handle the low-level interactions with CUBLAS.
affects: All versions
gotchaApplications relying on CUBLAS require proper environment variable configuration, especially `LD_LIBRARY_PATH` (on Linux) or system PATH (on Windows), to include the directory containing `libcublas.so` (or `cublas.dll`). Incorrect paths can lead to 'library not found' errors.
fix
Verify that your `LD_LIBRARY_PATH` (Linux) or system PATH (Windows) includes the `lib64` (Linux) or `bin` (Windows) directory of your CUDA Toolkit installation (e.g., `/usr/local/cuda/lib64`). Tools like `ldd` (Linux) can help diagnose linking issues.
affects: All versions
gotchaMemory allocation errors or `CUBLAS_STATUS_INVALID_VALUE` are common when GPU memory is insufficient or if kernel parameters are incorrect. Ensure your GPU has enough memory for the operation.
fix
Monitor GPU memory usage with `nvidia-smi`. Optimize your workload sizes or use smaller batches. Review CUBLAS function parameters for correctness, as invalid inputs can trigger this error. Sometimes, reinstalling `nvidia-cublas-cu11` can resolve perceived library mismatches.
affects: All versions
Upgrade
Version history
11.11.3.6latest on PyPI · released Oct 18, 2022
Audit
Dependencies
CUDA ToolkitrequiredCUBLAS is part of the CUDA Toolkit; compatibility with the installed CUDA version is crucial.
NVIDIA GPU DriversrequiredRequires compatible NVIDIA GPU drivers for proper functionality.
numbaoptionalCommonly used Python library to expose CUDA/CUBLAS functionality in Python.
Agent activity
13 hits · last 30 days
node
10
Resources