pub struct RandomPlan<T: Element, const N: usize> { /* private fields */ }Expand description
Random-generator plan.
Generic on T so the same type can carry the FP generators
(RandomPlan<f32, N>, RandomPlan<f64, N>) and the Bernoulli
generator (RandomPlan<Bool, N>). The element kind is reasserted in
select() against the descriptor.
The plan owns a single cuRAND generator handle, created lazily on the
first call to run (or any of the typed run_* accessors). cuRAND
generators are not thread-safe; the plan is !Sync and !Send as a
consequence (the Cell<curandGenerator_t> makes both negative).
Implementations§
Source§impl<T: Element, const N: usize> RandomPlan<T, N>
impl<T: Element, const N: usize> RandomPlan<T, N>
Sourcepub fn select(
_stream: &Stream,
desc: &RandomDescriptor<N>,
_pref: PlanPreference,
) -> Result<Self>
pub fn select( _stream: &Stream, desc: &RandomDescriptor<N>, _pref: PlanPreference, ) -> Result<Self>
Pick a kernel + validate the descriptor.
Sourcepub fn workspace_size(&self) -> usize
pub fn workspace_size(&self) -> usize
Workspace size in bytes.
Bernoulli needs numel * sizeof(f32) bytes for the uniform-rand
intermediate buffer cuRAND writes into. Uniform / Normal need
zero — cuRAND writes directly to the caller-provided output.
Sourcepub fn precision_guarantee(&self) -> PrecisionGuarantee
pub fn precision_guarantee(&self) -> PrecisionGuarantee
Numerical guarantees.