|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Performs initialization.
1
|
aclError aclInit(const char *configPath) |
1
|
ret = acl.init(config_path) |
|
Parameter |
Description |
|---|---|
|
config_path |
Path of the configuration file, including the file name. The configuration file is in JSON format. A JSON file allows up to 10 levels of curly brackets and square brackets, respectively. To use the default configurations, directly call the acl.init interface without passing any parameter or set the configuration file to an empty JSON string (that is, only {} exists in the configuration file). The configuration file is in JSON format. The following configurations are supported:
NOTE:
Dump configuration and profiling configuration should not be both set. The dump operation could affect the system performance, resulting in inaccurate profile data collected by Profiling. |
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code. 0 on success; else, failure. |
acl.init must be called before app development using pyacl APIs. Otherwise, an error may occur during the initialization of internal system resources, causing other service exceptions.
aclInit --> Service processing --> aclFinalize --> aclInit --> Service processing --> aclFinalize
After you call aclInit multiple times, you only need to call aclFinalize once to perform deinitialization. The aclInit reference count will be reset to 0.
aclFinalizeReference involves reference counting. Each time aclInit is called, the reference count is incremented by 1. Each time aclFinalizeReference is called, the reference count decreases by 1. Deinitialization is performed only when the reference count decreases to 0.
Repeated initialization and deinitialization are supported. The APIs can be called in sequence or concurrently. The API call sequence is as follows:
{
"dump":{
"dump_path":"output",
"dump_debug":"on"
}
}
After obtaining the exported data files, parse the files by referring to Collecting and Analyzing Data of Overflow/Underflow Operators in Accuracy Analyzer.
{
"dump":{
"dump_list":[
{
"layer":["A", "B"],
"watcher_nodes":["C", "D"]
}
],
"dump_path":"/home/",
"dump_mode":"output",
"dump_level":"op",
"dump_scene":"watcher"
}
}
The details are as follows:
The exported dump files cannot be viewed using a text tool. To view the content of a dump file, convert the dump file to a NumPy file and then view the NumPy file using Python. For details about the conversion procedure, see Viewing Dump Files in Accuracy Analyzer.
If the default value is used, there are a large number of dump files, for example, dump files starting with aclnn. If you have requirements on the dump performance or the memory resources are limited, you can set this parameter to the op level to improve the dump performance and reduce the number of dump files.
Note: An operator represents a computational logic (such as addition, subtraction, multiplication, and division). A kernel is the implementation that executes this computational logic, and requires allocation of specific computing devices to complete computation.
Configure the dump_kernel_data parameter to enable the operator kernel debugging information dump function. The following is an example of the configuration file:
{
"dump":{
"dump_kernel_data":"printf,assert",
"dump_path":"/home/"
}
}
The details are as follows:
The priorities of the dump file storage paths are as follows: ASCEND_DUMP_PATH environment variable > ASCEND_WORK_PATH environment variable > dump_path in the configuration file. For details about the environment variables, see Environment Variables.
The content of the exported dump file cannot be directly viewed using a text tool. To view the content, use the show_kernel_debug_data tool to parse the debugging information into a readable format. For details about how to use the tool, see show_kernel_debug_data in Ascend C Operator Development.
Set the device ID in default_device, which can be 0 or a decimal positive integer. You can call aclrtGetDeviceCount to obtain the number of available devices. The value range of the device ID is [0, (Number of available devices – 1)].
The following gives a configuration example:
{
"defaultDevice":{
"default_device":"0"
}
}
Use aicore_stack_size to set the stack size, in bytes. The value must meet the following requirements:
For the
For the
For the
For the
The following gives a configuration example:
{
"StackSize":{
"aicore_stack_size":32768
}
}
simt_stack_size specifies the stack size of each thread of the SIMT operator. The unit is byte.
The simt_divergence_stack_size parameter is used to set the size of the branch (Divergence) stack space of the SIMT operator. The unit is byte.
The values of simt_stack_size and simt_divergence_stack_size must be an integer multiple of 128. If the input value is not a multiple of 128, the API automatically rounds up the value to ensure that it is a multiple of 128.
The following gives a configuration example:
{
"StackSize": {
"simt_stack_size": 1024,
"simt_divergence_stack_size": 512
}
}
The simt_printf_fifo_size parameter is used to set the size of the Printf maintenance and test space of the SIMT operator. The unit is byte. The value must be an integer multiple of 8. If the input value is not an integer multiple of 8, the API automatically rounds up the value to ensure that it is an integer multiple of 8.
The default value of simt_printf_fifo_size is 2 MB. The minimum value is 1 MB and the maximum value is 64 MB.
The following gives a configuration example:
{
"simt_printf_fifo_size": 1048576
}
The simd_printf_fifo_size_per_core parameter is used to set the size of the Printf maintenance and test space of the SIMD operator. The unit is byte. The value must be an integer multiple of 8. If the input value is not an integer multiple of 8, the API automatically rounds up the value to ensure that it is an integer multiple of 8.
The default value of simd_printf_fifo_size_per_core is 32 KB. The minimum value is 1 KB and the maximum value is 64 MB.
The following gives a configuration example:
{
"simd_printf_fifo_size_per_core": 1048576
}
For the API call example, see Initialization and Deinitialization.
More flexible APIs are provided for enabling dump or profiling. Unlike aclInit, these APIs can be called repeatedly in a process, allowing varied dump/profiling configurations with each call.