Engine

Overview

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

// typedefs

typedef struct dnnl_engine* dnnl_engine_t;

// enums

enum dnnl_engine_kind_t;

// structs

struct dnnl_engine;
struct dnnl::engine;

// global functions

dnnl_engine_kind_t dnnl::convert_to_c(engine::kind akind);
size_t DNNL_API dnnl_engine_get_count(dnnl_engine_kind_t kind);

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

dnnl_status_t DNNL_API dnnl_engine_get_kind(
    dnnl_engine_t engine,
    dnnl_engine_kind_t* kind
    );

dnnl_status_t DNNL_API dnnl_engine_destroy(dnnl_engine_t engine);

Detailed Documentation

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

Typedefs

typedef struct dnnl_engine* dnnl_engine_t

An engine handle.

Global Functions

dnnl_engine_kind_t dnnl::convert_to_c(engine::kind akind)

Converts engine kind enum value from C++ API to C API type.

Parameters:

akind

C++ API engine kind enum value.

Returns:

Corresponding C API engine kind enum value.

size_t DNNL_API dnnl_engine_get_count(dnnl_engine_kind_t kind)

Returns the number of engines of a particular kind.

Parameters:

kind

Kind of engines to count.

Returns:

Count of the engines.

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

Creates an engine.

Parameters:

engine

Output engine.

kind

Engine kind.

index

Engine 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.

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:

engine

Engine to query.

kind

Output engine kind.

Returns:

dnnl_success on success and a status describing the error otherwise.

dnnl_status_t DNNL_API dnnl_engine_destroy(dnnl_engine_t engine)

Destroys an engine.

Parameters:

engine

Engine to destroy.

Returns:

dnnl_success on success and a status describing the error otherwise.