Registry / ai-ml / nvidia-curand

nvidia-curand

JSON →
library10.4.3.29pypypi✓ verified 24d ago

The `nvidia-curand` library provides the native CURAND shared libraries, making them discoverable via `pip` for Python packages that utilize GPU-accelerated random number generation. It is not intended for direct Python API calls but serves as a crucial dependency for libraries like CuPy and Numba. The current version is 10.4.2.51, and its releases are typically tied to updates of the NVIDIA CUDA Toolkit.

pip install nvidia-curand
INSTALL
IMPORT
SIG · NVIDIA-CURAND
N
nvidia-curand
ai-mlpythonv10.4.3.29
Install
2.8s avg
Import
Disk
81MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.0a0 · 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
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.000s · 148MB
81MB installed
● package 81MB
Code
Verified usage

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

None (native library)
This package is not typically imported directly for Python symbols.
It provides underlying native cuRAND libraries that other Python libraries (e.g., CuPy, Numba) link against to enable GPU-accelerated random number generation. You interact with cuRAND indirectly through these higher-level wrappers.

Demonstrates how CuPy, which relies on native libraries like those provided by `nvidia-curand`, can generate GPU-accelerated random numbers. This package ensures the underlying cuRAND shared objects are available for CuPy and similar libraries. A functional NVIDIA GPU and compatible drivers are required for this code to run successfully.

import cupy as cp import os # This quickstart demonstrates how CuPy, which uses cuRAND (provided by nvidia-curand), # generates random numbers on the GPU. Ensure an NVIDIA GPU and drivers are installed. # Optional: Set CUDA_VISIBLE_DEVICES if you have multiple GPUs and want to specify one # os.environ['CUDA_VISIBLE_DEVICES'] = '0' try: # Generate 5 random floats on the GPU using CuPy gpu_random_numbers = cp.random.rand(5) print("GPU Random Numbers (CuPy using cuRAND):", gpu_random_numbers) # Verify the device print(f"Generated on device: {gpu_random_numbers.device}") # Perform a basic GPU calculation with another random array gpu_array_a = cp.array([10.0, 20.0, 30.0], dtype=cp.float32) gpu_array_b = cp.random.rand(3, dtype=cp.float32) # Uses cuRAND gpu_result = gpu_array_a * gpu_array_b print("GPU Array A:", gpu_array_a) print("GPU Array B (random):", gpu_array_b) print("GPU Result (A * B):", gpu_result) except cp.cuda.runtime.CUDARuntimeError as e: print(f"CUDA Error encountered: {e}") print("Please ensure you have an NVIDIA GPU, compatible drivers, and CUDA toolkit installed.") print("Also, verify that CuPy is installed and configured correctly.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
gotchaThe `nvidia-curand` package primarily provides native shared libraries and is not designed for direct Python API calls or symbol imports. Python users typically interact with cuRAND through higher-level libraries like CuPy or Numba.
fix
Use a Python wrapper library like CuPy (`import cupy as cp`) or Numba for GPU-accelerated random number generation. Ensure these wrappers are compatible with the `nvidia-curand` version you have installed.
affects: All versions
gotcha`nvidia-curand` requires an NVIDIA GPU and compatible NVIDIA drivers to be installed on your system. Without these, the native libraries cannot be utilized, leading to runtime errors in dependent packages.
fix
Install the appropriate NVIDIA GPU drivers for your hardware. Ensure your system meets the minimum requirements for the CUDA Toolkit version associated with `nvidia-curand`.
affects: All versions
breakingIncompatibility between the installed `nvidia-curand` version, your system's CUDA Toolkit, and your GPU drivers can lead to runtime failures (`CUDARuntimeError`). Versioning is critical for NVIDIA's CUDA ecosystem.
fix
Always ensure that the `nvidia-curand` package, your system's CUDA Toolkit, GPU drivers, and any dependent Python libraries (like CuPy) are compatible. Refer to NVIDIA's documentation for specific version compatibility matrices.
affects: All versions
gotchaWhile `pip install nvidia-curand` makes the native libraries available, you might still need to configure environment variables (e.g., `LD_LIBRARY_PATH` on Linux) in certain complex setups or if other CUDA installations interfere, to ensure dependent libraries find the correct `cuRAND` shared objects.
fix
For most standard installations, `pip` manages paths automatically. If you encounter library not found errors, check your `LD_LIBRARY_PATH` (Linux) or `PATH` (Windows) and ensure it includes the directory where the `nvidia-curand` shared libraries are installed (usually within your Python environment's `site-packages/nvidia/curand/lib`).
affects: All versions
Upgrade
Version history
10.4.3.29latest on PyPI · released May 26, 2026
Audit
Dependencies
nvidia-cuda-runtimerequiredProvides core CUDA runtime libraries, which `nvidia-curand` depends on.
Agent activity
9 hits · last 30 days
node
6
Resources
nvidia-curand — pip install nvidia-curand · libregistry