﻿# rocRAND: a seed does not fully specify output ordering across GPUs

Record generator type, output ordering, offset and library context when comparing rocRAND results; distinguish statistical validity from exact sequence reproducibility.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-rocrand-seed-ordering-reproducibility-contract/
Language: en

## Distinguish a random distribution from an exact array

A stochastic kernel can consume statistically appropriate samples without producing an identical array on every configuration. Decide which property the experiment needs before diagnosing a mismatch. For model debugging, exact sample identity can isolate another code change. For a distributional experiment, statistical properties may be the intended criterion. Neither goal is established merely by writing the same seed in a log while leaving the rest of the generation path unspecified.

## Record the selected ordering explicitly

The [rocRAND programming guide](https://rocm.docs.amd.com/projects/rocRAND/en/latest/conceptual/programmers-guide.html) explains output-ordering choices and notes that dynamic ordering can vary sequences across GPU models and library versions. The guide separately describes legacy ordering for backward-compatible sequence generation. Check the selected generator's supported modes rather than assuming all enum values apply universally. Include the actual mode in the experiment manifest alongside generator family and seed.

## Treat configuration changes as state changes

The [host API reference](https://rocm.docs.amd.com/projects/rocRAND/en/latest/doxygen/html/group__rocrandhost.html) states that setting ordering resets internal generator state while preserving the seed. Applying the setter midway through a job is therefore not merely attaching a label. Compare the operation sequence leading to generation when investigating a repeated or changed sample prefix. An apparently identical final configuration can conceal a different amount of previously consumed random state.

## Compare the intended generated representation

The [current public header](https://raw.githubusercontent.com/ROCm/rocm-libraries/develop/projects/rocrand/library/include/rocrand/rocrand.h) distinguishes generator controls and distribution-specific generation functions. Preserve output type and distribution parameters as well as generator settings. Comparing raw integer output to transformed floating-point samples asks a different question from comparing the same API under another build. First establish the same generation operation, then use an appropriate exact or statistical comparison.

## Keep a useful reproducibility record

Capture a small output sample with the API, generator, ordering, offset, call history and runtime identity. A changed result is evidence to investigate, not automatic proof of broken hardware or a defective random distribution. The existing [HIP portability guide](/journal/learn-hip-launch-portability/) and [software reproducibility guide](/journal/software-stack-reproducibility/) support related platform context. A precise record makes stochastic GPU behavior explainable without promising that an unchanged seed guarantees every downstream model result across systems.
