NVIDIA CUBLAS Runtime Libraries

13.3.0.5 · active · verified Thu Apr 09

The `nvidia-cublas` package provides the native runtime libraries for NVIDIA's CUBLAS (CUDA Basic Linear Algebra Subroutines). It acts as a foundational dependency, allowing other Python deep learning and scientific computing frameworks (like PyTorch, TensorFlow, and CuPy) to leverage GPU-accelerated linear algebra operations efficiently. It is currently at version 13.3.0.5 and typically receives updates aligned with new NVIDIA CUDA Toolkit releases.

Warnings

Install

Quickstart

This quickstart demonstrates how to verify that your system has CUDA (and by extension, CUBLAS through `nvidia-cublas`) correctly configured and available for a framework like PyTorch. This package itself does not expose a direct Python API, but rather provides the underlying shared libraries for other GPU-accelerated libraries. Ensure `torch` is installed (`pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118` or similar for your CUDA version).

import torch

def check_cublas_availability():
    # Ensure PyTorch is installed and CUDA is available for CUBLAS to be used
    try:
        if not torch.cuda.is_available():
            print("CUDA is not available. CUBLAS operations will run on CPU or not at all.")
            return

        print(f"CUDA is available. Device name: {torch.cuda.get_device_name(0)}")
        print(f"Number of CUDA devices: {torch.cuda.device_count()}")

        # Perform a simple matrix multiplication that typically uses CUBLAS
        a = torch.randn(1000, 1000, device='cuda')
        b = torch.randn(1000, 1000, device='cuda')
        c = torch.matmul(a, b)
        print("Successfully performed a GPU matrix multiplication (likely using CUBLAS).")
        print(f"Result shape: {c.shape}")
    except Exception as e:
        print(f"An error occurred during CUDA operation: {e}")
        print("This might indicate an issue with CUBLAS, CUDA installation, or drivers.")

if __name__ == "__main__":
    check_cublas_availability()

view raw JSON →