context.h
Overview
Provides Context APIs for configuring runtime information.
Since: 9
Related Modules:
Summary
Types
Name | Description |
---|---|
OH_AI_ContextHandle | Defines the pointer to the MindSpore context. |
OH_AI_DeviceInfoHandle | Defines the pointer to the MindSpore device information. |
Functions
Name | Description |
---|---|
OH_AI_ContextCreate () | Creates a context object. |
OH_AI_ContextDestroy (OH_AI_ContextHandle *context) | Destroys a context object. |
OH_AI_ContextSetThreadNum (OH_AI_ContextHandle context, int32_t thread_num) | Sets the number of runtime threads. |
OH_AI_ContextGetThreadNum (const OH_AI_ContextHandle context) | Obtains the number of threads. |
OH_AI_ContextSetThreadAffinityMode (OH_AI_ContextHandle context, int mode) | Sets the affinity mode for binding runtime threads to CPU cores, which are categorized into little cores and big cores depending on the CPU frequency. |
OH_AI_ContextGetThreadAffinityMode (const OH_AI_ContextHandle context) | Obtains the affinity mode for binding runtime threads to CPU cores. |
OH_AI_ContextSetThreadAffinityCoreList (OH_AI_ContextHandle context, const int32_t *core_list, size_t core_num) | Sets the list of CPU cores bound to a runtime thread. |
OH_AI_ContextGetThreadAffinityCoreList (const OH_AI_ContextHandle context, size_t *core_num) | Obtains the list of bound CPU cores. |
OH_AI_ContextSetEnableParallel (OH_AI_ContextHandle context, bool is_parallel) | Sets whether to enable parallelism between operators. |
OH_AI_ContextGetEnableParallel (const OH_AI_ContextHandle context) | Checks whether parallelism between operators is supported. |
OH_AI_ContextAddDeviceInfo (OH_AI_ContextHandle context, OH_AI_DeviceInfoHandle device_info) | Adds information about a running device. |
OH_AI_DeviceInfoCreate (OH_AI_DeviceType device_type) | Creates a device information object. |
OH_AI_DeviceInfoDestroy (OH_AI_DeviceInfoHandle *device_info) | Destroys a device information instance. |
OH_AI_DeviceInfoSetProvider (OH_AI_DeviceInfoHandle device_info, const char *provider) | Sets the name of a provider. |
OH_AI_DeviceInfoGetProvider (const OH_AI_DeviceInfoHandle device_info) | Obtains the provider name. |
OH_AI_DeviceInfoSetProviderDevice (OH_AI_DeviceInfoHandle device_info, const char *device) | Sets the name of a provider device. |
OH_AI_DeviceInfoGetProviderDevice (const OH_AI_DeviceInfoHandle device_info) | Obtains the name of a provider device. |
OH_AI_DeviceInfoGetDeviceType (const OH_AI_DeviceInfoHandle device_info) | Obtains the type of a provider device. |
OH_AI_DeviceInfoSetEnableFP16 (OH_AI_DeviceInfoHandle device_info, bool is_fp16) | Sets whether to enable float16 inference. This function is available only for CPU/GPU devices. |
OH_AI_DeviceInfoGetEnableFP16 (const OH_AI_DeviceInfoHandle device_info) | Checks whether float16 inference is enabled. This function is available only for CPU/GPU devices. |
OH_AI_DeviceInfoSetFrequency (OH_AI_DeviceInfoHandle device_info, int frequency) | Sets the NPU frequency type. This function is available only for NPU devices. |
OH_AI_DeviceInfoGetFrequency (const OH_AI_DeviceInfoHandle device_info) | Obtains the NPU frequency type. This function is available only for NPU devices. |