NVIDIA CURAND for CUDA 11
The `nvidia-curand-cu11` package provides the native runtime libraries for NVIDIA's CUDA Random Number Generation (CURAND) library, specifically compiled for CUDA 11 environments. CURAND delivers high-performance GPU-accelerated random number generation, offering various algorithms and distribution options for scientific computing, machine learning, and deep learning applications. This package acts as a low-level dependency for higher-level Python libraries that utilize GPU-accelerated random number generation. The current version is 10.3.0.86, with releases typically having a slow cadence.
Warnings
- breaking CUDA Version Mismatch: This package is specifically for CUDA 11. Mixing `nvidia-*-cu11` packages with `nvidia-*-cu12` (or other CUDA versions) in the same Python environment, or using them with a system-installed CUDA Toolkit of a different major version, can lead to runtime errors or undefined behavior.
- gotcha GPU Driver Compatibility: `pip` installations of NVIDIA CUDA packages do not check or install GPU drivers. The system's NVIDIA GPU driver must be compatible with the CUDA 11 version targeted by `nvidia-curand-cu11` for the package to function correctly. Outdated drivers can lead to GPU detection issues or runtime failures.
- gotcha No Direct Python API: This package provides the underlying native CURAND shared libraries/DLLs, not a direct Python API. You cannot `import nvidia_curand_cu11` and call functions directly from it. Functionality is exposed through higher-level Python wrappers (e.g., CuPy, Numba, PyTorch) that dynamically link against these runtime components.
- gotcha Proprietary License: `nvidia-curand-cu11` is distributed under an NVIDIA Proprietary Software License. Users should be aware of the licensing terms for their projects.
- deprecated Future CUDA 11.x Deprecation: Newer CUDA Toolkit releases (e.g., CUDA 13.0) have begun deprecating support for CUDA 11.x. While `nvidia-curand-cu11` is currently active, users should be mindful that future developments will focus on newer CUDA versions (e.g., `cu12`, `cu13`), and `cu11` packages may eventually become unsupported.
Install
-
pip install nvidia-curand-cu11
Imports
- N/A (Runtime Library)
Functionality accessed via libraries like CuPy, Numba, or PyTorch.
Quickstart
# This package provides runtime libraries; direct import is not applicable.
# Instead, CURAND's functionality (GPU random numbers) is typically accessed via other Python libraries.
# Here's an example using CuPy, which implicitly uses CURAND:
try:
import cupy as cp
import numpy as np
# Initialize a GPU random number generator
rng = cp.random.default_rng()
# Generate 5 random floats on the GPU
gpu_random_numbers = rng.random(5)
print(f"GPU Random Numbers (CuPy): {gpu_random_numbers}")
# Transfer to CPU for verification (optional)
cpu_array = gpu_random_numbers.get()
print(f"CPU Array (NumPy from CuPy): {cpu_array}")
except ImportError:
print("CuPy not installed. Install with: pip install cupy-cuda11x")
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure you have a compatible NVIDIA GPU, CUDA 11 toolkit, and appropriate drivers installed.")