mkl::rng::generate

Entry point to obtain random numbers from a given engine with proper statistics of a given distribution.

Syntax

Buffer API

template<typename Distr, typename Engine>

void generate (const Distr& distr, Engine& engine, std::int64_t n, cl::sycl::buffer<typename Distr::result_type, 1>& r);

USM API

template<typename Distr, typename Engine>

cl::sycl::event generate (const Distr& distr, Engine& engine, std::int64_t n, typename Distr::result_type* r , const cl::sycl::vector_class<cl::sycl::event> & dependencies);

Include Files

Input Parameters

Name

Type

Description

distr

const Distr&

Distribution object. See Distributions for details.

engine

Engine&

Engine object. See Engines for details.

n

std::int64_t

Number of random values to be generated.

Optional Input Parameter for USM API

Name

Type

Description

dependencies

const cl::sycl::vector_class <cl::sycl::event> &

List of events to wait for before starting computation, if any.

Output Parameters

Buffer API

Name

Type

Description

r

cl::sycl::buffer<typename Distr::result_type, 1>

cl::sycl::bufferr to the output vector.

USM API

Name

Type

Description

r

typename Distr::result_type*

Pointer r to the output vector.

event

cl::sycl::event

Function return event after submitting task in cl::sycl::queue from the engine.

mkl::rng::generate submits a kernel into a queue that is held by the engine and fills cl::sycl::buffer/typename Distr::result_type* vector with n random numbers.