Deep Neural Network Library (DNNL)  1.3.0
Performance library for Deep Learning
Classes | Typedefs | Enumerations | Functions
Engine

An abstraction of a computational device: a CPU, a specific GPU card in the system, etc. More...

Classes

struct  dnnl::engine
 An execution engine. More...
 
struct  dnnl_engine
 An opaque structure to describe an engine. More...
 

Typedefs

typedef struct dnnl_enginednnl_engine_t
 An engine handle.
 

Enumerations

enum  dnnl_engine_kind_t
 Kinds of engines. More...
 

Functions

size_t DNNL_API dnnl_engine_get_count (dnnl_engine_kind_t kind)
 Returns the number of engines of a particular kind. More...
 
dnnl_status_t DNNL_API dnnl_engine_create (dnnl_engine_t *engine, dnnl_engine_kind_t kind, size_t index)
 Creates an engine. More...
 
dnnl_status_t DNNL_API dnnl_engine_create_ocl (dnnl_engine_t *engine, dnnl_engine_kind_t kind, cl_device_id device, cl_context context)
 Creates an engine associated with an OpenCL device and an OpenCL context. More...
 
dnnl_status_t DNNL_API dnnl_engine_get_kind (dnnl_engine_t engine, dnnl_engine_kind_t *kind)
 Returns the kind of an engine. More...
 
dnnl_status_t DNNL_API dnnl_engine_get_ocl_context (dnnl_engine_t engine, cl_context *context)
 Returns the OpenCL context associated with an engine. More...
 
dnnl_status_t DNNL_API dnnl_engine_get_ocl_device (dnnl_engine_t engine, cl_device_id *device)
 Returns the OpenCL device associated with an engine. More...
 
dnnl_status_t DNNL_API dnnl_engine_destroy (dnnl_engine_t engine)
 Destroys an engine. More...
 

Detailed Description

An abstraction of a computational device: a CPU, a specific GPU card in the system, etc.

Most primitives are created to execute computations on one specific engine. The only exceptions are reorder primitives that transfer data between two different engines.

See also
Basic Concepts

Enumeration Type Documentation

◆ dnnl_engine_kind_t

Kinds of engines.

Enumerator
dnnl_any_engine 

An unspecified engine.

dnnl_cpu 

CPU engine.

dnnl_gpu 

GPU engine.

Function Documentation

◆ dnnl_engine_get_count()

size_t DNNL_API dnnl_engine_get_count ( dnnl_engine_kind_t  kind)

Returns the number of engines of a particular kind.

Parameters
kindKind of engines to count.
Returns
Count of the engines.

◆ dnnl_engine_create()

dnnl_status_t DNNL_API dnnl_engine_create ( dnnl_engine_t engine,
dnnl_engine_kind_t  kind,
size_t  index 
)

Creates an engine.

Parameters
engineOutput engine.
kindEngine kind.
indexEngine index that should be between 0 and the count of engines of the requested kind.
Returns
dnnl_success on success and a status describing the error otherwise.
Examples:
cnn_inference_f32.c, cpu_cnn_training_f32.c, and cross_engine_reorder.c.

◆ dnnl_engine_create_ocl()

dnnl_status_t DNNL_API dnnl_engine_create_ocl ( dnnl_engine_t engine,
dnnl_engine_kind_t  kind,
cl_device_id  device,
cl_context  context 
)

Creates an engine associated with an OpenCL device and an OpenCL context.

Parameters
engineOutput engine.
kindEngine kind.
deviceUnderlying OpenCL device to use for the engine.
contextUnderlying OpenCL context to use for the engine.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_engine_get_kind()

dnnl_status_t DNNL_API dnnl_engine_get_kind ( dnnl_engine_t  engine,
dnnl_engine_kind_t kind 
)

Returns the kind of an engine.

Parameters
engineEngine to query.
kindOutput engine kind.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_engine_get_ocl_context()

dnnl_status_t DNNL_API dnnl_engine_get_ocl_context ( dnnl_engine_t  engine,
cl_context *  context 
)

Returns the OpenCL context associated with an engine.

Parameters
engineEngine to query.
contextOutput underlying OpenCL context of the engine.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_engine_get_ocl_device()

dnnl_status_t DNNL_API dnnl_engine_get_ocl_device ( dnnl_engine_t  engine,
cl_device_id *  device 
)

Returns the OpenCL device associated with an engine.

Parameters
engineEngine to query.
deviceOutput underlying OpenCL device of the engine.
Returns
dnnl_success on success and a status describing the error otherwise.

◆ dnnl_engine_destroy()

dnnl_status_t DNNL_API dnnl_engine_destroy ( dnnl_engine_t  engine)

Destroys an engine.

Parameters
engineEngine to destroy.
Returns
dnnl_success on success and a status describing the error otherwise.
Examples:
cnn_inference_f32.c, cpu_cnn_training_f32.c, and cross_engine_reorder.c.