﻿# rocRAND Sobol: dimension count is part of the sample layout

Use rocRAND quasi-random output with explicit dimension count and flattening conventions; distinguish a vector of coordinates from unrelated scalar random draws.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-rocrand-sobol-dimensions-point-layout-contract/
Language: en

## Define a point before allocating its coordinates

A quasi-random integration experiment evaluates a function on points with several coordinates. Treating the generated buffer as an unordered supply of scalar noise loses that structure. Define the dimension associated with each physical or model parameter, and decide how a complete point reaches the consumer. This matters when replacing a pseudorandom kernel with Sobol generation: matching only output type and total length does not establish the same interpretation of an input example.

## Set the supported generator dimension

The [rocRAND host API](https://rocm.docs.amd.com/projects/rocRAND/en/latest/doxygen/html/group__rocrandhost.html) provides a quasi-random dimension setter and documents that generation lengths must respect the generator's dimension. Check return statuses instead of assuming that a configured value was accepted. A padded allocation can hold extra coordinates, but padding alone does not authorize the consumer to treat an incomplete tail as another valid point.

## Read the documented flattening convention

The [programming guide](https://rocm.docs.amd.com/projects/rocRAND/en/latest/conceptual/programmers-guide.html) describes the ordering of multidimensional Sobol output in global memory. Keep that convention in the adapter between generation and model input. A generic reshape can group coordinates incorrectly while preserving both array size and numerical range. Inspect a tiny generated layout by coordinate identity before using a large statistical test, where plausible averages may conceal a transposed point representation.

## Distinguish changing dimension from advancing the sequence

The [public API header](https://raw.githubusercontent.com/ROCm/rocm-libraries/develop/projects/rocrand/library/include/rocrand/rocrand.h) declares separate dimension, offset and generation operations. The dimension setter has state-reset semantics documented by the API; it is not a harmless display option. Configure the experiment before generation and record any subsequent changes. Do not interpret a restarted or regrouped output segment as evidence that the mathematical generator itself produced duplicate independent samples.

## Validate the consumer's parameter mapping

For a diagnostic function, make each coordinate play an identifiable role and compare the intended point matrix with the consumer's actual reads. Preserve the map through batching and storage conversion. The existing [HIP portability guide](/journal/learn-hip-launch-portability/) and [software reproducibility guide](/journal/software-stack-reproducibility/) support related implementation context. A defensible Sobol experiment records dimension, buffer ordering, sequence controls and tail treatment so the computed statistic refers to the intended multidimensional sampling problem.
