onemkl::rng::generate

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

Syntax

Buffer API

template<typename T, method Method, template<typename, method> class Distr, typename EngineType>
void generate(const Distr<T, Method> &distr, EngineType &engine, const std::int64_t n, cl::sycl::buffer<T, 1> &r)

USM API

template<typename T, method Method, template<typename, method> class Distr, typename EngineType>
cl::sycl::event generate(const Distr<T, Method> &distr, EngineType &engine, const std::int64_t n, T *r, const cl::sycl::vector_class<cl::sycl::event> &dependencies)

Include Files

  • mkl_sycl.hpp

Input Parameters

Name

Type

Description

distr

const Distr<T, Method>

Distribution object. See Distributions for details.

engine

EngineType

Engine object. See Engines for details.

n

const std::int64_t

Number of random values to be generated.

Output Parameters

Buffer API

Name

Type

Description

r

cl::sycl::buffer<T, 1>

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

USM API

Name

Type

Description

r

T*

Pointer r to the output vector.

event

cl::sycl::event

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

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