oneapi::mkl::rng::device::engine_descriptor

Host side helper to provide an abstraction over sycl::buffer to initialize and store engines’ states between DPC++ kernels.

Syntax

template<Engine>
class engine_descriptor {
public:
engine_descriptor(sycl::queue& queue, sycl::range<1> range, std::uint64_t seed, std::uint64_t offset);
template<typename InitEngineFunc>
engine_descriptor(sycl::queue& queue, sycl::range<1> range, InitEngineFunc func);
engine_accessor<Engine> get_access(sycl::handler& cgh);
};

Include Files

  • oneapi/mkl/rng/device.hpp

Description

engine_descriptor provides an abstraction over sycl::buffer to initialize and store engines’ states between SYCL kernels.

Note

The constructor of the engine descriptor submits a parallel_for task to a given queue to initialize engines’ states:

Each engine is initialized as Engine {seed, id * offset} for scalar offset case, where id is a value from 0 to range.size().

Template Parameters

Type

Description

Engine

Specify an engine which state is hold by engine descriptor.

Constructors Input Parameters

Name

Type

Description

queue

sycl::queue&

sycl::queue object. Task is submitted to this queue to initialize engines’ states directly on the device which is associated with queue.

range

sycl::range<1>

Describes number of engines which are hold by this engine_descriptor object.

seed

std::uint64_t/std::initializer_list<std::uint64_t>

Initial conditions of the engine state.

offset

std::uint64_t/std::initializer_list<std::uint64_t>

Number of skipped elements, for initializer_list offset is calculated as: num_to_skip[0]+ num_to_skip[1]*264+ num_to_skip[2]* 2128+ … +num_to_skip[n-1]*264*(``n`-1)`.

func

InitEngineFunc

Functor which would be used to initialize engines. This functor should take sycl::item<1> as an argument and return object of type Engine