NVIDIA CURAND CUDA 12 Runtime Libraries

10.3.10.19 · active · verified Sat Mar 28

The `nvidia-curand-cu12` package provides the native runtime libraries for NVIDIA's CUDA Random Number Generation (CURAND) library, specifically compiled for CUDA Toolkit 12.x. It acts as a foundational dependency for higher-level Python libraries that wrap CUDA functionalities, enabling GPU-accelerated random number generation. The current version is 10.3.10.19, and it typically follows the CUDA Toolkit's release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how a higher-level library like CuPy would utilize the underlying CURAND runtime provided by `nvidia-curand-cu12`. The `nvidia-curand-cu12` package itself does not expose direct Python APIs for import, but rather provides the necessary native libraries for GPU-accelerated random number generation that CuPy (or similar libraries) wrap. Ensure CuPy is installed (`pip install cupy-cuda12x`) and a CUDA-capable GPU is present.

# The nvidia-curand-cu12 package itself is not directly imported.
# Instead, its functionalities are used by other libraries.
# Here's an example using CuPy, which would leverage CURAND under the hood.
import cupy as cp

# Ensure a CUDA-capable GPU is available
if cp.cuda.is_available():
    print(f"CUDA is available. Current device: {cp.cuda.Device().name}")

    # Generate random numbers using CuPy, which utilizes CURAND
    # on the GPU if nvidia-curand-cu12 is correctly installed and configured.
    gpu_random_array = cp.random.rand(5)
    print("GPU-generated random array:", gpu_random_array)

    # Example of generating normally distributed random numbers
    gpu_normal_array = cp.random.normal(loc=0.0, scale=1.0, size=5)
    print("GPU-generated normal array:", gpu_normal_array)

else:
    print("CUDA is not available. Please ensure a compatible GPU and CUDA Toolkit are installed.")

view raw JSON →