oneAPI Deep Neural Network Library (oneDNN)  1.4.0
Performance library for Deep Learning
Loading...
Searching...
No Matches
dnnl::engine Struct Reference

An execution engine. More...

#include <dnnl.hpp>

Inheritance diagram for dnnl::engine:
Collaboration diagram for dnnl::engine:

Public Types

enum class  kind
 Kinds of engines. More...

Public Member Functions

 engine ()=default
 Constructs an empty engine.
 engine (kind kind, size_t index)
 Constructs an engine.
 engine (kind kind, cl_device_id device, cl_context context)
 Constructs an engine from OpenCL device and context objects.
 engine (const handle< dnnl_primitive_desc_t > &pd)
 Constructs an engine based on a primitive from the primitive descriptor pd by querying its engine.
kind get_kind () const
 Returns the kind of the engine.
cl_context get_ocl_context () const
 Returns the OpenCL context associated with the engine.
cl_device_id get_ocl_device () const
 Returns the OpenCL device associated with the engine.
 handle ()=default
 Constructs an empty handle object.
 handle (const handle< T, traits > &)=default
 Copy constructor.
 handle (handle< T, traits > &&)=default
 Move constructor.
 handle (T t, bool weak=false)
 Constructs a handle wrapper object from a C API handle.
Public Member Functions inherited from dnnl::handle< dnnl_engine_t >
 handle ()=default
 Constructs an empty handle object.
handle< dnnl_engine_t, handle_traits< dnnl_engine_t > > & operator= (const handle< dnnl_engine_t, handle_traits< dnnl_engine_t > > &)=default
 Assignment operator.
void reset (dnnl_engine_t t, bool weak=false)
 Resets the handle wrapper objects to wrap a new C API handle.
dnnl_engine_t get (bool allow_empty=false) const
 Returns the underlying C API handle.
 operator dnnl_engine_t () const
 Converts a handle to the underlying C API handle type.
 operator bool () const
 Checks whether the object is empty.

Static Public Member Functions

static size_t get_count (kind kind)
 Returns the number of engines of a certain kind.
template<typename primitive_desc>
static engine query (const primitive_desc &pd)
 Returns the engine of a primitive descriptor.

Detailed Description

Member Enumeration Documentation

◆ kind

Constructor & Destructor Documentation

◆ engine() [1/4]

dnnl::engine::engine ( )
default

Constructs an empty engine.

An empty engine cannot be used in any operations.

◆ engine() [2/4]

dnnl::engine::engine ( kind kind,
size_t index )
inline

Constructs an engine.

Parameters
kindThe kind of engine to construct.
indexThe index of the engine. Must be less than the value returned by get_count() for this particular kind of engine.

◆ engine() [3/4]

dnnl::engine::engine ( kind kind,
cl_device_id device,
cl_context context )
inline

Constructs an engine from OpenCL device and context objects.

Parameters
kindThe kind of engine to construct.
deviceThe OpenCL device that this engine will encapsulate.
contextThe OpenCL context (containing the device) that this engine will use for all operations.

◆ engine() [4/4]

dnnl::engine::engine ( const handle< dnnl_primitive_desc_t > & pd)
inline

Constructs an engine based on a primitive from the primitive descriptor pd by querying its engine.

Parameters
pdThe primitive descriptor to query.

Member Function Documentation

◆ get_count()

size_t dnnl::engine::get_count ( kind kind)
inlinestatic

Returns the number of engines of a certain kind.

Parameters
kindThe kind of engines to count.
Returns
The number of engines of the specified kind.

◆ get_kind()

kind dnnl::engine::get_kind ( ) const
inline

Returns the kind of the engine.

Returns
The kind of the engine.

◆ get_ocl_context()

cl_context dnnl::engine::get_ocl_context ( ) const
inline

Returns the OpenCL context associated with the engine.

Returns
OpenCL context.

◆ get_ocl_device()

cl_device_id dnnl::engine::get_ocl_device ( ) const
inline

Returns the OpenCL device associated with the engine.

Returns
OpenCL device.

◆ query()

template<typename primitive_desc>
engine dnnl::engine::query ( const primitive_desc & pd)
inlinestatic

Returns the engine of a primitive descriptor.

Parameters
pdThe primitive descriptor to query.
Returns
A weak handle to the engine that the primitive descriptor was created with.

◆ handle() [1/2]

dnnl::handle< T, traits >::handle ( )
default

Constructs an empty handle object.

Warning
Uninitialized object cannot be used in most library calls and is equivalent to a null pointer. Any attempt to use its methods, or passing it to the other library function, will cause an exception to be thrown.

◆ handle() [2/2]

dnnl::handle< T, traits >::handle ( T t,
bool weak = false )
inlineexplicit

Constructs a handle wrapper object from a C API handle.

Parameters
tThe C API handle to wrap.
weakA flag specifying whether to construct a weak wrapper; defaults to false.

The documentation for this struct was generated from the following file: