{"id":546,"library":"nvidia-cublas-cu12","title":"NVIDIA cuBLAS Runtime Library (CUDA 12.x)","description":"nvidia-cublas-cu12 provides the native runtime libraries for NVIDIA's CUBLAS (CUDA Basic Linear Algebra Subprograms) on CUDA 12.x enabled systems. It's a GPU-accelerated library designed for high-performance linear algebra operations crucial for AI, machine learning, and high-performance computing (HPC) applications. This Python package acts as a runtime dependency for other Python libraries that leverage cuBLAS functionalities, rather than exposing a direct Python API itself. The current version is 12.9.2.10, and it is actively maintained with frequent updates.","status":"active","version":"12.9.2.10","language":"python","source_language":"en","source_url":"https://pypi.org/project/nvidia-cublas-cu12/","tags":["cuda","nvidia","cublas","blas","gpu","hpc","deep learning","machine learning","runtime"],"install":[{"cmd":"pip install nvidia-cublas-cu12","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required base CUDA NVRTC runtime library for CUDA 12.x compatibility.","package":"nvidia-cuda-nvrtc-cu12","optional":false},{"reason":"An example of a higher-level Python library that can use nvidia-cublas-cu12 as an optional backend for accelerated linear algebra. Requires installing with `[cu12]` extra.","package":"nvmath-python","optional":true},{"reason":"Deep learning frameworks like PyTorch often depend on specific nvidia-*cu12 packages for CUDA acceleration.","package":"torch","optional":true}],"imports":[{"note":"nvidia-cublas-cu12 is a runtime dependency, not a Python library with direct callable symbols. Its functionality is accessed indirectly by libraries like CuPy or PyTorch.","symbol":"libcublas","correct":"This package does not expose direct Python imports. It provides native shared libraries (e.g., libcublas.so, cublas.dll) that other Python libraries link against."}],"quickstart":{"code":"import os\n# nvidia-cublas-cu12 itself does not have direct Python imports or a quickstart.\n# Its purpose is to provide the underlying shared libraries for other Python packages.\n# For example, nvmath-python can leverage it.\n# To use a library that depends on nvidia-cublas-cu12, you'd typically install it like:\n# pip install nvmath-python[cu12] cupy-cuda12x\n\n# Example of how a dependent library (like nvmath-python or CuPy) *might*\n# indicate the presence of cuBLAS. This code is conceptual, not direct use of this package.\n# Replace with actual usage from a wrapper library if available and runnable.\n\ntry:\n    # Attempt to import a library that *uses* cuBLAS if installed\n    import cupy as cp\n    print(f\"CuPy version: {cp.__version__}\")\n    print(f\"CuPy CUDA enabled: {cp.cuda.is_available()}\")\n    if cp.cuda.is_available():\n        a = cp.random.rand(5, 5)\n        b = cp.random.rand(5, 5)\n        c = a @ b # This operation would internally use cuBLAS\n        print(f\"CuPy matrix multiplication (via cuBLAS if linked) successful.\\nResult shape: {c.shape}\")\n    else:\n        print(\"CuPy is installed but CUDA is not available. Ensure drivers and CUDA runtime are correctly set up.\")\nexcept ImportError:\n    print(\"CuPy not installed. Install with `pip install cupy-cuda12x` to test CUDA functionality.\")\nexcept Exception as e:\n    print(f\"An error occurred during CuPy test: {e}\")\n\n# The presence of `nvidia-cublas-cu12` itself can be verified at the system level.\n# For direct validation of the package installation:\nimport pkg_resources\ntry:\n    distribution = pkg_resources.get_distribution('nvidia-cublas-cu12')\n    print(f\"\\nPackage 'nvidia-cublas-cu12' is installed. Version: {distribution.version}\")\nexcept pkg_resources.DistributionNotFound:\n    print(\"Package 'nvidia-cublas-cu12' not found. Please install it.\")","lang":"python","description":"This package primarily installs native runtime shared libraries, and does not provide a direct Python API for end-user interaction. Its functionality is exposed through higher-level Python wrappers like CuPy or frameworks like PyTorch. The quickstart demonstrates how to verify the installation of the `nvidia-cublas-cu12` package and conceptually shows how a dependent library like CuPy would leverage the underlying CUBLAS functionality if properly set up. For actual usage of cuBLAS operations, refer to the documentation of libraries that wrap cuBLAS (e.g., `nvmath-python`, `CuPy`, `PyTorch`)."},"warnings":[{"fix":"Ensure all `nvidia-*cuXX` packages, the system CUDA Toolkit, and any dependent libraries (e.g., PyTorch, TensorFlow, CuPy) are aligned to the same major CUDA version (e.g., CUDA 12.x for `cu12`). Regularly update GPU drivers.","message":"Major version numbers (e.g., `cu12` vs. `cu11`) indicate compatibility with specific CUDA Toolkit versions. Mixing `nvidia-cublas-cu12` with libraries compiled for older CUDA versions (e.g., `cu11`) or an incompatible system CUDA toolkit can lead to runtime errors like 'undefined symbols' or 'failed to load shared library'.","severity":"breaking","affected_versions":"All versions"},{"fix":"If you need to build applications that link against cuBLAS, install the full NVIDIA CUDA Toolkit appropriate for your system and target CUDA version, in addition to or instead of the PyPI package.","message":"The `pip` wheels for `nvidia-cublas-cu12` are intended for runtime use and do not include developer tools (like `nvcc`) or header files necessary for compiling applications against cuBLAS. For development purposes (e.g., building custom CUDA extensions), a full NVIDIA CUDA Toolkit installation is typically required.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly set a workspace for cuBLAS operations when capturing them in CUDA graphs using `cublasSetWorkspace()`. Refer to the cuBLAS documentation for details on workspace management.","message":"When using cuBLAS functions within CUDA graphs in cuBLAS 12.x, not explicitly providing a workspace can lead to `cudaErrorNotSupported (801)` due to stream-ordered memory allocations. This is a change from older cuBLAS versions.","severity":"gotcha","affected_versions":"cuBLAS 12.x and later"},{"fix":"Ensure `LD_LIBRARY_PATH` (Linux) or `PATH` (Windows) includes the directory where the native CUDA and cuBLAS libraries are installed. For pip installations, these are typically within the Python environment's `site-packages` directory or a system-wide CUDA installation. `CUDA_HOME` should point to your CUDA installation directory.","message":"Incorrect `LD_LIBRARY_PATH` or `CUDA_HOME` environment variables can prevent Python applications from finding the installed native cuBLAS shared libraries, resulting in 'cannot open shared object file' errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure all necessary runtime and testing dependencies, such as CuPy, are installed in your environment if you intend to fully verify CUDA functionality.","message":"Testing of CUDA-dependent functionality for `nvidia-cublas-cuXX` may be skipped or incomplete if required libraries like CuPy (e.g., `cupy-cuda12x`) are not installed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To install this package, you must first install `nvidia-pyindex` to configure pip to use the NVIDIA Python Package Index. The correct installation sequence is: `pip install nvidia-pyindex` followed by `pip install nvidia-cublas-cu12`.","message":"The package `nvidia-cublas-cu12` (and similar `nvidia-*cuXX` packages) available on PyPI.org are often placeholder projects. These packages are primarily hosted on the NVIDIA Python Package Index.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'12':6,28 '12.9.2.10':87 'acceler':37 'act':62 'activ':91 'ai':49 'algebra':24,45 'api':81 'applic':58 'basic':22 'blas':99 'comput':56 'crucial':47 'cu12':11 'cubla':2,10,20,73,98 'cuda':5,21,27,96 'current':84 'deep':102 'depend':66 'design':39 'direct':79 'enabl':30 'expos':77 'frequent':94 'function':74 'gpu':36,100 'gpu-acceler':35 'high':42,54 'high-perform':41,53 'hpc':57,101 'learn':51,103,105 'leverag':72 'librari':4,16,38,70 'linear':23,44 'machin':50,104 'maintain':92 'nativ':14 'nvidia':1,9,18,97 'nvidia-cublas-cu12':8 'oper':46 'packag':61 'perform':43,55 'provid':12 'python':60,69,80 'rather':75 'runtim':3,15,65,106 'subprogram':25 'system':31 'updat':95 'version':85 'x':7,29","created_at":"2026-03-28T15:18:17.222291+00:00","updated_at":"2026-04-16T17:26:34.970504+00:00","problems":{"verify_error":"no import statement found"},"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"12.9.2.10","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.nvidia.com/cuda-zone","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/nvidia-cublas-cu12/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"skip","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":"stale"}}