NVIDIA CURAND for CUDA 11

10.3.0.86 · active · verified Sat Apr 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

Install

Imports

Quickstart

Since `nvidia-curand-cu11` is a runtime library, it doesn't have a direct Python quickstart. Instead, you would use a Python library like CuPy (shown below) or PyTorch, which leverage the underlying CURAND functionalities for GPU-accelerated random number generation. This example demonstrates generating random numbers directly on the GPU using CuPy's random number generator, which is built upon CURAND.

# 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.")

view raw JSON →