Skip to main content

Module dist

Module dist 

Source
Expand description

Distribution dispatchers.

Distribution<T> enumerates every supported distribution; the T parameter (f32 or f64) is enforced through crate::dtype::RngFloatSupported. FillRequest<T> pairs a distribution with the GpuRef<T> target and a oneshot reply channel; it implements RngDispatch so the actor can route any float dtype through a single mailbox variant.

§Coverage matrix

distributionf32f64path
Uniformcudarc::curand::CudaRng::fill_with_uniform
Normal…fill_with_normal
LogNormal…fill_with_log_normal
Poissonu32 fill via curandGeneratePoisson, then host-side widen
Exponentialuniform fill + caller transform (see note)
Betaneeds a custom kernel — returns LibraryError
Cauchyneeds a custom kernel — returns LibraryError
Gammaneeds a custom kernel — returns LibraryError
Discreteneeds curandCreatePoissonDistribution + custom kernel

cuRAND’s host-API natively exposes only Uniform / Normal / LogNormal / Poisson; the four “✗” rows depend on either NVRTC- generated kernels or device-API calls. Phase 1’s job is to freeze the type-level surface so callers can write code today that auto-grows when those paths land. Each unsupported variant returns a clearly-tagged GpuError::LibraryError { lib: "curand", msg: "<dist> not yet wired (Phase 1: needs custom kernel)" } so users get one consistent error to match on.

Structs§

FillRequest
Single typed fill request: RngActor accepts any Box<FillRequest<T>> through RngMsg::Fill(_).

Enums§

Distribution
Every distribution the cuRAND surface is intended to expose. Variants that aren’t yet wired to a kernel return a tagged LibraryError from FillRequest::fill.

Traits§

NormalParam
Helper trait so the enqueue_normal / log_normal paths can convert the parameter scalar (always T::Scalar) into the T value cudarc::curand::result::NormalFill::fill actually accepts. For both f32 and f64, scalar == self, so this is identity.