dsmi_set_user_config
Prototype
int dsmi_set_user_config(int device_id, const char *config_name, unsigned int buf_size, unsigned char *buf)
Description
Sets user configuration.
For the Ascend 310 AI Processor, this API supports mini modules (EP) and standard PCIe cards.
Parameters
Parameter |
Input/Output |
Description |
---|---|---|
device_id |
Input |
Device ID For the Ascend 310 AI Processor, the value range is 0–63. Obtain the actual device ID by calling dsmi_list_device. |
config_name |
Input |
Configuration name, up to 254 characters
NOTE:
For Ascend 310 AI Processors, after calling this API, run the reboot command to reboot the system for the configuration to take effect. Then, you can inspect the configuration result by calling dsmi_get_user_config. |
buf_size |
Input |
Buffer size, up to 1024 bytes
|
buf |
Input |
Buffer pointer, pointing to the configuration option
|
Returns
Type |
Description |
---|---|
int |
0 on success; else, failure |
Restrictions
- Run the caller application as the root user on a physical machine. Otherwise, a permission error is returned.
- Enabling the ECC may consume DDR memory, resulting in inference performance degradation.
- Since the flash memory has a limited number of program/erase cycles, avoid unnecessary calls to this API.
Example
Setting config_name as ddr_mac_enable is used as an example as follows.
#define BUF_SIZE 1 int ret = 0; int device_id = 0; char *config_name = "ddr_mac_enable"; char buf[BUF_SIZE] = {0}; // Set buf. ... ret=dsmi_set_user_config(device_id,config_name, BUF_SIZE, buf); if(ret != 0){ //To-do: records logs. return ret; } ...