Open Deep Learning API
Loading...
Searching...
No Matches
odla_device.h
Go to the documentation of this file.
1//===- odla_device.h ------------------------------------------------------===//
2//
3// Copyright (C) 2019-2020 Alibaba Group Holding Limited.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16// =============================================================================
17
18#ifndef _ODLA_DEVICE_H_
19#define _ODLA_DEVICE_H_
20
21#include <ODLA/odla_value.h>
22
27#ifdef __cplusplus
28extern "C" {
29#endif
30
32typedef enum {
33 ODLA_VENDOR_DEFAULT,
34 ODLA_VENDOR_ALIBABA,
35 ODLA_VENDOR_ARM,
36 ODLA_VENDOR_CAMBRICON,
37 ODLA_VENDOR_GRAPHCORE,
38 ODLA_VENDOR_HABANA,
39 ODLA_VENDOR_INTEL,
40 ODLA_VENDOR_NVIDIA,
41 ODLA_VENDOR_QUALCOMM,
43
45typedef enum {
46 OVI_DESCRIPTION,
47 OVI_FEATURE_SET,
49
51typedef enum {
52 ODLA_DEVICE_DEFAULT,
53 // Alibaba
54 ODLA_DEVICE_ALIBABA_HANGUANG,
55 // ARM
56 ODLA_DEVICE_ARM_CORTEX_M,
57 // Cambricon
58 ODLA_DEVICE_CAMBRICON_MLU220,
59 ODLA_DEVICE_CAMBRICON_MLU270,
60 // GraphCore
61 ODLA_DEVICE_GRAPHCORE_IPU,
62 // Intel Habana
63 ODLA_DEVICE_HABANA_GAUDI,
64 ODLA_DEVICE_HABANA_GOYA,
65 // Intel CPU
66 ODLA_DEVICE_INTEL_X86,
67 ODLA_DEVICE_INTEL_DNNL,
68 // NVidia
69 ODLA_DEVICE_NVIDIA_GPU,
70 ODLA_DEVICE_NVIDIA_TENSORRT,
71 // Qualcomm
72 ODLA_DEVICE_QUALCOMM_AIC100,
74
76typedef enum {
93
95typedef struct _odla_vendor* odla_vendor;
96
98typedef struct _odla_device* odla_device;
99
101typedef struct _odla_device_config* odla_device_config;
102
104typedef struct _odla_device_config_item* odla_device_config_item;
105
107
113extern ODLA_API_EXPORT odla_status ODLA_API_CALL
114odla_GetVendor(const odla_vendor_name vendor_name, odla_vendor* vendor);
115
117
127 const odla_vendor vendor, const odla_vendor_info info_name,
128 const odla_size_t allocated_info_value_size, odla_void* info_value,
129 odla_size_t* retrieved_info_value_size);
130
132
139extern ODLA_API_EXPORT odla_status ODLA_API_CALL
141 odla_int32 device_idx, odla_device* device);
142
144
153extern ODLA_API_EXPORT odla_status ODLA_API_CALL
155 odla_scalar_value* info_value);
156
158
164extern ODLA_API_EXPORT odla_status ODLA_API_CALL
166
168
173extern ODLA_API_EXPORT odla_status ODLA_API_CALL
175
177
182extern ODLA_API_EXPORT odla_status ODLA_API_CALL
184
186
191extern ODLA_API_EXPORT odla_status ODLA_API_CALL
193
195
202extern ODLA_API_EXPORT odla_status ODLA_API_CALL
204 odla_device_config_item device_config_item, ...);
205
207
212extern ODLA_API_EXPORT odla_status ODLA_API_CALL
214
215#ifdef __cplusplus
216} // C extern
217#endif
218
219#endif // _ODLA_DEVICE_H_
__INT32_TYPE__ odla_int32
Definition: odla_common.h:66
#define ODLA_API_EXPORT
API export directives.
Definition: odla_common.h:172
odla_status
Return status.
Definition: odla_common.h:140
__SIZE_TYPE__ odla_size_t
size_t
Definition: odla_common.h:134
void odla_void
void
Definition: odla_common.h:137
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_CreateDeviceConfig(odla_device_config *device_config)
Create a device config object.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetVendor(const odla_vendor_name vendor_name, odla_vendor *vendor)
Get the vendor object.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_InitDevice(odla_device device, const odla_device_config config)
Initialize an allocated device.
odla_device_info
Device info enum.
Definition: odla_device.h:76
@ ODLA_DEVICE_INFO_POWER_LIMIT
Power limit in watt (float)
Definition: odla_device.h:89
@ ODLA_DEVICE_INFO_DEV_INDEX
Device index of current device (int32)
Definition: odla_device.h:79
@ ODLA_DEVICE_INFO_DEV_COUNT
Number of total devices (int32)
Definition: odla_device.h:78
@ ODLA_DEVICE_INFO_ODLA_LIB_VERSION
Version of ODLA library (string)
Definition: odla_device.h:77
@ ODLA_DEVICE_INFO_MEMORY_UTIL
Definition: odla_device.h:84
@ ODLA_DEVICE_INFO_DEV_UUID
Raw UUID of device (16-byte string)
Definition: odla_device.h:81
@ ODLA_DEVICE_INFO_SDK_VERSION
Version of SDK (string)
Definition: odla_device.h:91
@ ODLA_DEVICE_INFO_USED_MEMORY
Size of used device memory (int64)
Definition: odla_device.h:87
@ ODLA_DEVICE_INFO_TOTAL_MEMORY
Size of device memory (int64)
Definition: odla_device.h:86
@ ODLA_DEVICE_INFO_DRIVER_VERSION
Version of driver (string)
Definition: odla_device.h:90
@ ODLA_DEVICE_INFO_POWER_USAGE
Current power usage in watt (float)
Definition: odla_device.h:88
@ ODLA_DEVICE_INFO_PROCESSOR_UTIL
Definition: odla_device.h:82
@ ODLA_DEVICE_INFO_DEV_TYPE
Name/model of device (string)
Definition: odla_device.h:80
odla_vendor_info
Vendor info.
Definition: odla_device.h:45
struct _odla_device_config * odla_device_config
Device configuration object.
Definition: odla_device.h:101
struct _odla_device_config_item * odla_device_config_item
Device configuration item object.
Definition: odla_device.h:104
struct _odla_vendor * odla_vendor
Vendor object.
Definition: odla_device.h:95
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_AllocateDevice(odla_vendor vendor, odla_device_name device_name, odla_int32 device_idx, odla_device *device)
Allocate a device.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetDeviceConfigItem(odla_device_config device_config, odla_device_config_item device_config_item,...)
Set the device config with a property item.
odla_device_name
Supported devices.
Definition: odla_device.h:51
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_DestroyDeviceConfig(odla_device_config device_config)
Destroy a device config object.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetVendorInfo(const odla_vendor vendor, const odla_vendor_info info_name, const odla_size_t allocated_info_value_size, odla_void *info_value, odla_size_t *retrieved_info_value_size)
Get the vendor info.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_DestroyDevice(odla_device device)
Destroy an allocated device.
struct _odla_device * odla_device
Device object.
Definition: odla_device.h:98
odla_vendor_name
Supported vendors.
Definition: odla_device.h:32
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetDeviceInfo(odla_device device, odla_device_info info_type, odla_scalar_value *info_value)
Get the device info.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetCurrentDevice(odla_device device)
Set an allocated device as the current device.