2. Initialization and Deinitialization
This chapter describes the initialization and deinitialization APIs of CANN Runtime, including initialization and deinitialization of the ACL environment and related callback registration.
aclError aclInit(const char *configPath): Initialization function.aclError aclFinalize(): Deinitialization function, used for releasing the resources used by ACL APIs within the process.aclError aclFinalizeReference(uint64_t *refCount): Deinitialization function, used for releasing the resources used by ACL APIs within the process.aclError aclInitCallbackRegister(aclRegisterCallbackType type, aclInitCallbackFunc cbFunc, void *userData): Registers an initialization callback function.aclError aclInitCallbackUnRegister(aclRegisterCallbackType type, aclInitCallbackFunc cbFunc): If the callback function does not need to be triggered, call this API to unregister the callback function.aclError aclFinalizeCallbackRegister(aclRegisterCallbackType type, aclFinalizeCallbackFunc cbFunc, void *userData): Registers a deinitialization callback function.aclError aclFinalizeCallbackUnRegister(aclRegisterCallbackType type, aclFinalizeCallbackFunc cbFunc): If the callback function does not need to be triggered, call this API to unregister the callback function.
aclInit
aclError aclInit(const char *configPath)
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
Initialization function.
When developing applications using ACL APIs, you must call the aclInit API first. Otherwise, subsequent internal system resource initialization may fail, which in turn causes other service exceptions.
Parameters
| Parameter | Input/Output | Description |
|---|---|---|
| configPath | Input | Pointer to the path (including the file name) of the configuration file. The configuration file content is in JSON format (the nesting level of "{" in the JSON file is at most 10, and the nesting level of "[" is at most 10). During initialization, this configuration file can be used to enable Dump, configure Profiling collected information, and other functions. For details, see the descriptions in the configuration examples of each function below. If the default configuration meets your requirements and no modification is needed, you can pass NULL to the aclInit API, or configure the configuration file as an empty JSON string (that is, the configuration file contains only {}). |
Return Values
Returns 0 on success and other values on failure. See aclError.
Constraints
- A process supports calling the aclInit API multiple times for initialization, but must call the aclFinalize or aclFinalizeReference API for deinitialization. The following scenarios are supported:
-
Each time the aclInit API is called, the configuration must remain consistent. Otherwise, only the configuration of the first call takes effect, and subsequent calls to the aclInit API may cause errors or invalid configuration.
-
For compatibility with earlier versions, calling the aclInit API repeatedly returns the ACL_ERROR_REPEAT_INITIALIZE error code. You can ignore this error and continue processing services.
-
If the aclInit and aclFinalize APIs are called to implement initialization and deinitialization respectively, repeated initialization and deinitialization are supported. In terms of timing, only sequential calls are supported. The API call sequence is as follows:
aclInit-->service processing-->aclFinalize-->aclInit-->service processing-->aclFinalizeIn this scenario, if the aclInit API is called multiple times before deinitialization, you only need to call the aclFinalize API once to directly clear the reference count of the aclInit API to zero.
-
If the aclInit and aclFinalizeReference APIs are called to implement initialization and deinitialization respectively, the aclInit and aclFinalizeReference APIs must be called in pairs.
Because the aclFinalizeReference API internally involves the implementation of reference counting, each call to the aclInit API increments the reference count by one, and each call to the aclFinalizeReference API decrements the reference count by one. Only when the reference count decreases to 0 is deinitialization actually performed.
Repeated initialization and deinitialization are supported. In terms of timing, both sequential calls and concurrent calls are supported. The API call sequence is as follows:
-
The sequential call sequence diagram is as follows:

-
The concurrent call sequence diagram is as follows:

-
-
Model Dump Configuration and Single Operator Dump Configuration
The exported data of model dump configuration (used to export the input and output data of each operator layer in a model) and single-operator dump configuration (used to export the input and output data of a single operator) is used for comparison with a specified model or operator to locate precision issues. For the specific comparison method, see Precision Debugging Tool User Guide. The dump configurations are disabled by default.
To enable the dump configuration through this API, configure the path for saving the dump data through the dump_path parameter.
The following is an example of the model dump configuration:
{
"dump":{
"dump_list":[
{ "model_name":"ResNet-101"
},
{
"model_name":"ResNet-50",
"layer":[
"conv1conv1_relu",
"res2a_branch2ares2a_branch2a_relu",
"res2a_branch1",
"pool1"
]
}
],
"dump_path":"/home/output",
"dump_mode":"output",
"dump_op_switch":"off",
"dump_data":"tensor"
}
}
In the single operator call scenario, the following is an example of the dump configuration:
{
"dump":{
"dump_path":"/home/output",
"dump_list":[{}],
"dump_op_switch":"on",
"dump_data":"tensor"
}
}
Abnormal Operator Dump Configuration
Abnormal operator Dump configuration is used to export the input and output data, workspace information, and tiling information of abnormal operators. The exported data is used to analyze AI Core Error issues. This Dump configuration is disabled by default.
For information collection and definitions related to AI Core Error issues, see Troubleshooting.
Enable the abnormal operator Dump function by configuring the dump_scene parameter value. The following example in the configuration file shows how to enable lightweight exception dump:
{
"dump":{
"dump_path":"output",
"dump_scene":"aic_err_brief_dump"
}
}
The detailed configuration description and constraints are as follows:
-
The dump_scene parameter supports the following values:
- aic_err_brief_dump: indicates lightweight exception dump, which is used to export the input and output data and workspace data of the AI Core error operator.
- aic_err_norm_dump: indicates standard exception dump. In addition to the data exported by lightweight exception dump, it also exports shape, data type, format, and attribute information.
-
aic_err_detail_dump: in addition to the data exported by lightweight exception dump, it also exports the internal storage, registers, and call stack information of the AI Core.
When this option is configured, note the following:
-
This option is supported only on the following models, and requires driver 25.0.RC1 or later:
Atlas A3 products
Atlas A2 products
You can click Link, download the Ascend HDK 25.0.RC1 or later driver installation package on the "Firmware & Driver" page, and install or upgrade it by referring to the documentation of the corresponding version.
-
During the export of dump files, the AI Core where the problematic operator resides is paused, which may affect the normal execution of other service processes on the device. After the dump files are exported, the AI Core automatically resumes. Therefore, in scenarios where multiple host-side user service processes specify the same device, using the aic_err_detail_dump option is not recommended.
-
After the dump files are exported, the host-side user service process is forcibly terminated. Errors reported during the forced termination should not be used as input for AI Core problem analysis.
-
After the aic_err_detail_dump option is configured, if dump files are generated but are not *.core files, it indicates that the function corresponding to aic_err_detail_dump is not enabled successfully, and the system automatically switches to dumping according to the aic_err_brief_dump option.
-
- lite_exception: indicates lightweight exception dump. For compatibility with earlier versions, its effect is equivalent to aic_err_brief_dump.
-
dump_path is an optional parameter that specifies the storage path for the exported dump files.
The priority of the dump file storage path is as follows: the NPU_COLLECT_PATH environment variable > ASCEND_WORK_PATH the environment variable > dump_path in the configuration file > the current execution directory of the application. For a detailed description of the environment variables, see Environment Variable Reference.
-
To view the exported dump file content, see the "Fault Locating Tool > msaicerr Tool Usage Guide > Parsing Dump Files" chapter in Troubleshooting.
If dump_scene is set to aic_err_detail_dump, use the msDebug tool to view the content of the exported dump files. For details, see Operator Development Tool User Guide.
- Abnormal operator dump configuration cannot be enabled together with model dump configuration or single operator dump configuration.
Overflow Operator Dump Configuration
Overflow Operator Dump Configuration is used to export the input and output data of overflow operators in a model. The exported data is used to analyze the cause of overflow and locate model accuracy issues. This dump configuration is disabled by default.
Set the dump_debug parameter to on to enable the overflow operator configuration. The sample content in the configuration file is as follows:
{
"dump":{
"dump_path":"output",
"dump_debug":"on"
}
}
The detailed configuration description and constraints are as follows:
-
If dump_debug is not configured or dump_debug is set to off, the overflow operator configuration is not enabled.
-
If the overflow operator configuration is enabled, dump_path must be configured, which specifies the storage path for exporting dump files.
After obtaining the exported data files, parse the files by referring to Precision Debugging Tool User Guide.
dump_path supports configuring an absolute path or a relative path:
- An absolute path starts with "/", for example: /home.
- A relative path starts directly with a directory name, for example: output.
-
The Overflow Operator Dump configuration cannot be enabled together with the model Dump configuration or the single operator Dump configuration; otherwise, an error is returned.
-
Only overflow data of AI Core operators is supported for collection.
Operator Dump Watch Mode Configuration
Operator Dump Watch Mode Configuration is used to enable the observation mode for the output data of specified operators. After locating the precision issue of some operators and ruling out the computation problem of the operators themselves, if you suspect that the precision issue is caused by other operators overwriting the memory, you can enable Dump Watch mode. Dump Watch mode is disabled by default.
Set the dump_scene parameter to watcher to enable Operator Dump Watch mode. The sample content in the configuration file is as follows. The configuration takes effect as follows: (1) After operator A and operator B are executed, the output of operator C and operator D is dumped. (2) After operator C and operator D are executed, the output of operator C and operator D is also dumped. Compare the dump files of operator C and operator D in (1) and (2) to check whether operator A and operator B overwrite the output memory of operator C and operator D.
{
"dump":{
"dump_list":[
{
"layer":["A", "B"],
"watcher_nodes":["C", "D"]
}
],
"dump_path":"/home/",
"dump_mode":"output",
"dump_level":"op",
"dump_scene":"watcher"
}
}
The detailed configuration description and constraints are as follows:
-
If Operator Dump Watch mode is enabled, Overflow Operator Dump (configured by the dump_debug parameter) or single-operator model Dump (configured by the dump_op_switch parameter) cannot be enabled at the same time. Otherwise, an error is reported. This mode does not take effect in the single-operator API Dump scenario.
-
In dump_list, the layer parameter specifies the names of operators whose memory may overwrite that of other operators, and the watcher_nodes parameter specifies the names of operators whose output memory may be overwritten by other operators, resulting in accuracy issues.
- If layer is not specified, after all operators that support Dump in the model are executed, the output of the operators configured in watcher_nodes is dumped.
- The operators configured in layer and watcher_nodes must be operators in a static graph or static subgraph. Otherwise, the configuration does not take effect.
- If the operator names configured in layer and watcher_nodes are the same, or if the operators configured in layer are collective communication operators (operator types start with Hcom, for example, HcomAllReduce), only the dump files of the operators configured in watcher_nodes are exported.
- For fused operators, the operator names configured in watcher_nodes must be the names after fusion. If the names before fusion are configured, no dump file is exported.
- Configuring model_name in dump_list is not supported yet.
-
When operator Dump Watch mode is enabled, dump_path must be configured to specify the storage path for exporting dump files.
The dump files collected here cannot be viewed directly with a text tool. To view the content of a dump file, first convert the dump file to a numpy format file, and then view the numpy-format file through Python. For detailed conversion steps, see Precision Debugging Tool User Guide.
dump_path supports configuring an absolute path or a relative path:
- An absolute path starts with "/", for example, /home.
- A relative path starts directly with a directory name, for example, output.
-
The dump_mode parameter controls which part of the data of the operator configured in watcher_nodes is exported. Currently, only output is supported.
-
Set the dump data level through dump_level. The values are as follows. Under the default configuration, there are many dump data files, for example, some dump files starting with aclnn. If users have requirements on dump performance or have limited memory resources, they can set this parameter to the op level to improve dump performance and reduce the number of dump data files.
- op: Dumps data at the operator level. An operator is a representation of computation logic (such as addition, subtraction, multiplication, and division).
- kernel: Dumps data at the kernel level.
- all: Default value. Data at both the op and kernel levels is dumped. A kernel is the implementation that actually performs computation and processing for the operation logic, and it needs to be allocated to a specific compute device to complete the computation.
Configuration for Dumping Operator Kernel Debugging Information
The configuration for dumping operator kernel debugging information is used to export the debugging information of Ascend C operator kernels, facilitating operator issue troubleshooting. This dump configuration is disabled by default.
Only the following models support this configuration:
Ascend 950PR&950DT products
Atlas A3 products
Atlas A2 products
Atlas 200I/500 A2 inference products
Atlas inference products
Configure the dump_kernel_data parameter to enable the operator kernel debugging information dump function. The following is an example in the configuration file:
{
"dump":{
"dump_kernel_data":"printf,assert",
"dump_path":"/home/"
}
}
The detailed configuration description and constraints are as follows:
-
dump_kernel_data: specifies the type of exported data. Multiple types can be configured, separated by commas (,). If this field is not configured but the model dump configuration or single-operator dump configuration is enabled, debugging information is exported as all by default.
The following types are currently supported:
- all: exports the output data of all the following debugging types.
- printf: exports the output data debugged through AscendC::printf.
- tensor: exports the output data debugged through AscendC::DumpTensor.
- assert: exports the output data debugged through assert/ascendc_assert.
- timestamp: exports the output data debugged through AscendC::PrintTimeStamp.
-
dump_path: When the operator kernel debugging information dump function is enabled, dump_path must be configured. It specifies the storage path of the exported Dump files, and supports both absolute and relative paths.
The priority of the Dump file storage path is as follows: the ASCEND_DUMP_PATH environment variable > the ASCEND_WORK_PATH environment variable > the dump_path in the configuration file. For a detailed description of the environment variables, see Environment Variable Reference.
The content of the exported Dump files cannot be viewed directly with a text tool. To view it, use the show_kernel_debug_data tool to parse the debugging information into a readable format. For instructions on using the tool, see Ascend C Operator Development Guide.
Profiling Information Collection Configuration
Profiling information collection configuration: For the configuration example, description, and constraints, see Performance Tuning Tool User Guide. Profiling information collection configuration is disabled by default.
It is recommended that dump information and profiling collected information not be configured at the same time. Otherwise, the dump operation affects system performance, causing the performance data metrics collected by profiling to be inaccurate.
Operator Cache Information Aging Configuration
Operator cache information aging configuration: When a single operator is executed in single-operator model mode (except for single operators executed through the aclopUpdateParams API), to save memory and balance call performance, you can configure the maximum length of the "operator type - single-operator model" mapping queue through the max_opqueue_num parameter. If the length reaches the maximum, the mapping information that has not been used for a long time and the single-operator models in the cache are deleted first, and then the latest mapping information and the corresponding single-operator models are loaded. If the maximum length of the mapping queue is not configured, the default maximum length is 20000.
Single-operator model execution refers to executing an operator based on graph IR. First, compile the operator (for example, use the ATC tool to compile the single-operator description file defined by Ascend IR into an operator OM model file), then call an acl API to load the operator model (for example, the aclopSetModelDir API), and finally call an acl API to execute the operator (for example, the aclopExecuteV2 API).
Configure the maximum length of the "operator type - single-operator model" mapping queue through the max_opqueue_num parameter to implement operator cache information aging. The example content in the configuration file is as follows:
{
"max_opqueue_num": "10000"
}
The related configuration description and constraints are as follows:
-
For statically loaded operators (referring to the *.om files compiled from single operators, for example, the aclopSetModelDir API), the aging configuration is invalid, and aging is not performed on the operator information of this part.
-
For online-compiled operators (referring to operators compiled directly by calling acl APIs, for example, aclopCompile and aclopCompileAndExecuteV2), the API internally loads the single-operator model according to the input parameters, and the aging configuration is valid.
If a user calls the aclopCompile API to compile an operator and the aclopExecuteV2 API to execute the operator, the operator must be executed in a timely manner after compilation. Otherwise, when the operator is executed, the operator information may have already been aged out and needs to be recompiled. It is recommended to call the aclopCompileAndExecuteV2 API to compile and execute the operator.
-
The API internally maintains separate mapping queues for static-shape and dynamic-shape operators, and the maximum length of both is the max_opqueue_num parameter value.
-
The max_opqueue_num parameter value is the sum of the number of single-operator models of statically loaded operators and the number of single-operator models of online-compiled operators. Therefore, the max_opqueue_num parameter value should be greater than the number of single-operator models of statically loaded operators available in the current process. Otherwise, the information of online-compiled operators cannot be aged out.
Error Information Reporting Mode Configuration
The error information reporting mode configuration controls whether the aclGetRecentErrMsg API obtains error information at the process level or thread level. By default, error information is obtained at the thread level.
err_msg_mode Value range of the parameter: 0 is the default value, indicating that error information is obtained at the thread level; 1 indicates that error information is obtained at the process level.
The following is an example of the content in the configuration file:
{
"err_msg_mode": "1"
}
Default Device Configuration Example
Default Device Configuration (used to configure the default compute device). If a device is also specified through the aclrtSetDevice API, the aclrtSetDevice API takes higher priority. After the user enables the default device function, if a context needs to be explicitly created, the aclrtSetDevice API must be called; otherwise, service exceptions may occur.
default_device Set the Device ID in the parameter. The Device ID can be set to 0 or a positive decimal integer. After the user calls the aclrtGetDeviceCount API to obtain the number of available devices, the value range of this Device ID is:[0, ( the number of available devices -1)].
The example content in the configuration file is as follows:
{
"defaultDevice":{
"default_device":"0"
}
}
AI Core Stack Space Size Configuration Example
AI Core stack space size configuration controls the stack space size allocated to each AI Core during kernel execution in a process. The default value is 32KB.
Ascend 950PR&950DT products support this configuration. When compiling AI Core operators, there is no need to enable the O0 switch.
Atlas A3 products and Atlas A2 products support this configuration. However, when compiling AI Core operators, the configured AI Core stack space size takes effect only when the O0 switch is enabled.
Atlas 200I/500 A2 inference products support this configuration. However, when compiling AI Core operators, the configured AI Core stack space size takes effect only when the O0 switch is enabled.
aicore_stack_size Set the stack space size at the parameter. The unit is byte, and the value must meet the following requirements:
-
aicore_stack_size must be an integer multiple of 16K. If the passed aicore_stack_size is not an integer multiple of 16K, it is rounded up to ensure that it is an integer multiple of 16K.
-
aicore_stack_size The minimum value is 32KB. If the passed aicore_stack_size is less than 32KB, the default configuration of 32KB is used.
-
The maximum values of aicore_stack_size for each product are as follows:
On Ascend 950PR&950DT products, the maximum value of aicore_stack_size is 128KB.
On Atlas A3 products and Atlas A2 products, aicore_stack_size the maximum value is 192 KB.
On Atlas 200I/500 A2 inference products, aicore_stack_size the maximum value is 7680 KB.
The following is an example of the content in the configuration file:
{
"StackSize":{
"aicore_stack_size":32768
}
}
SIMT Operator Stack Space Size Configuration Example
SIMT (Single Instruction Multiple Thread) stack space size configuration controls the stack space size of SIMT operators in each thread and the divergence stack space size of SIMT operators, in bytes.
This configuration is supported only by Ascend 950PR&950DT products.
simt_stack_size sets the stack space size of each thread for SIMT operators, in bytes. The default value is 1152 bytes.
simt_divergence_stack_size sets the divergence stack space size of SIMT operators, in bytes. The default value is 1024 bytes.
The values of simt_stack_size and simt_divergence_stack_size must be multiples of 128. If a value that is not a multiple of 128 is passed in, the API internally rounds it up to the nearest multiple of 128.
The following is an example of the content in the configuration file:
{
"StackSize": {
"simt_stack_size": 1024,
"simt_divergence_stack_size": 512
}
}
SIMT Printf Debug Space Size Configuration
The SIMT (Single Instruction Multiple Thread) Printf debug space size configuration controls the space size that a SIMT operator can use for Printf output, in bytes.
Only Ascend 950PR&950DT products support this configuration.
simt_printf_fifo_size Set the SIMT operator Printf debug space size in the parameter, in bytes. The value must be a multiple of 8. If the value passed in is not a multiple of 8, the API internally rounds it up to the nearest multiple of 8.
simt_printf_fifo_size The default value is 2 MB, the minimum value is 1 MB, and the maximum value is 64 MB.
The following is an example of the content in the configuration file:
{
"simt_printf_fifo_size": 1048576
}
SIMD Printf Debug Space Size Configuration Example
The SIMD (Single Instruction Multiple Data) Printf debug space size configuration controls the space size, in bytes, that SIMD operators on each core can use for Printf output. Only the following models support this configuration:
Only Ascend 950PR&950DT products, Atlas A3 products, and Atlas A2 products support this configuration.
simd_printf_fifo_size_per_core In the parameter, set the SIMD operator Printf debug space size, in bytes. The value must be a multiple of 8. If the value passed in is not a multiple of 8, the API internally rounds it up to the nearest multiple of 8.
simd_printf_fifo_size_per_core The default value is 32 KB, the minimum value is 1 KB, and the maximum value is 64 MB.
The following is an example in the configuration file:
{
"simd_printf_fifo_size_per_core": 1048576
}
aclFinalize
aclError aclFinalize()
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
Deinitialization function used to release the resources used by the acl APIs within the process.
For scenarios where device service logs are reported back to the host, this API adds a 2000 ms delay by default (the actual maximum delay can reach 2000 ms) to ensure that ERROR-level and EVENT-level logs are completely reported back and prevent loss. You can set the ASCEND_LOG_DEVICE_FLUSH_TIMEOUT environment variable to 0 (command example: export ASCEND_LOG_DEVICE_FLUSH_TIMEOUT=0) to cancel this default delay. For a detailed description of the ASCEND_LOG_DEVICE_FLUSH_TIMEOUT environment variable, see ASCEND_LOG_DEVICE_FLUSH_TIMEOUT in Environment Variable Reference.
Parameters
None
Return Values
Returns 0 on success and other values on failure. See aclError.
Constraints
Before the application process exits, ensure that aclFinalize or aclFinalizeReference has been called to complete deinitialization. Otherwise, exceptions may occur, for example, an error is reported when the application process exits.
It is not recommended to call aclFinalize or aclFinalizeReference in a destructor. Otherwise, the process may exit abnormally when it exits because the destruction order of singletons is unknown.
aclFinalizeReference
aclError aclFinalizeReference(uint64_t *refCount)
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
Deinitialization function, used to release the resources used by the acl APIs within the process.
The aclFinalizeReference API internally involves reference counting. Each time the aclInit API is called, the reference count is incremented by one; each time the aclFinalizeReference API is called, the reference count is decremented by one. Only when the reference count reaches 0 is deinitialization actually performed. The difference between the aclFinalize API and this API is that calling the aclFinalize API clears the count to zero and performs deinitialization directly.
Parameters
| Parameter | Input/Output | Description |
|---|---|---|
| refCount | Input & output | Returns the reference count after aclFinalizeReference is called.If the reference count does not need to be obtained, nullptr can be passed here. |
Return Values
Returns 0 on success and other values on failure. See aclError.
Constraints
Before the application process exits, ensure that aclFinalize or aclFinalizeReference has been called to complete deinitialization. Otherwise, exceptions may occur, for example, an error is reported when the application process exits.
It is not recommended to call aclFinalize or aclFinalizeReference in a destructor. Otherwise, the process may exit abnormally when it exits because the destruction order of singletons is unknown.
aclInitCallbackRegister
aclError aclInitCallbackRegister(aclRegisterCallbackType type, aclInitCallbackFunc cbFunc, void *userData)
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
Registers an initialization callback function.
If this API is called before aclInit, the callback function is triggered during initialization. If this API is called after aclInit, the callback function is triggered immediately upon registration.
Parameters
| Parameter | Input/Output | Description |
|---|---|---|
| type | Input | Registration type, distinguished by function. See aclRegisterCallbackType. |
| cbFunc | Input | Initialization callback function. The function prototype of the callback function is as follows: typedef aclError (aclInitCallbackFunc)(const charconfigStr, size_t len, void *userData); configStr is consistent with the JSON file content in the aclInit API; len indicates the length of the JSON file content, in bytes. |
| userData | Input | Pointer to the user data to be passed to the callback function. |
Return Values
Returns 0 on success and other values on failure. See aclError.
aclInitCallbackUnRegister
aclError aclInitCallbackUnRegister(aclRegisterCallbackType type, aclInitCallbackFunc cbFunc)
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
If callback function invocation does not need to be triggered, call this API to unregister the callback function.
Parameters
| Parameter Name | Input/Output | Description |
|---|---|---|
| type | Input | Registration type, distinguished by function. See aclRegisterCallbackType. |
| cbFunc | Input | Initialization callback function. The function prototype of the callback function is as follows: typedef aclError (aclInitCallbackFunc)(const charconfigStr, size_t len, void *userData); |
Return Values
Returns 0 on success and other values on failure. See aclError.
aclFinalizeCallbackRegister
aclError aclFinalizeCallbackRegister(aclRegisterCallbackType type, aclFinalizeCallbackFunc cbFunc, void *userData)
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
Registers a deinitialization callback function.
Call this API before aclFinalize to trigger the callback function during deinitialization.
Parameters
| Parameter | Input/Output | Description |
|---|---|---|
| type | Input | Registration type, distinguished by function. See aclRegisterCallbackType. |
| cbFunc | Input | Deinitialization callback function. The callback function is defined as follows: typedef aclError (aclFinalizeCallbackFunc)(voiduserData); |
| userData | Input | Pointer to the user data to be passed to the callback function. |
Return Values
Returns 0 on success and other values on failure. See aclError.
aclFinalizeCallbackUnRegister
aclError aclFinalizeCallbackUnRegister(aclRegisterCallbackType type, aclFinalizeCallbackFunc cbFunc)
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Description
If the callback function does not need to be triggered, call this API to unregister the callback function.
Parameters
| Parameter | Input/Output | Description |
|---|---|---|
| type | Input | Registration type, distinguished by function. See aclRegisterCallbackType. |
| cbFunc | Input | Deinitialization callback function. The callback function is defined as follows: typedef aclError (aclFinalizeCallbackFunc)(voiduserData); |
Return Values
Returns 0 on success and other values on failure. See aclError.