Specifies the devices that are visible to the current process. One or more device IDs can be specified at a time. By using this environment variable, you can adjust the devices without modifying the application.
Device ID indicates the logical ID of the AI processor. For example, if the number of available devices is 8, the device IDs are 0, 1, 2, 3, 4, 5, 6, and 7. The application scenarios are as follows:
Multiple device IDs are separated by commas (,). Other characters or invalid device IDs are not allowed. If other characters or invalid device IDs are contained, only the device IDs before them are read. For example, if there is a space before 2 in the environment variable setting command export ASCEND_RT_VISIBLE_DEVICES=1, 2,3, only the device ID before the space (1) is read; if 8 is an invalid device ID in the environment variable setting command export ASCEND_RT_VISIBLE_DEVICES=1,3,8, only device IDs before 8 (1 and 3) are read.
Use cases:
Execute the offline inference program.
The TensorFlow/PyTorch framework network performs training or online inference on the Ascend platform.
export ASCEND_RT_VISIBLE_DEVICES=1
export ASCEND_RT_VISIBLE_DEVICES=1,2,3
In the scenario where the TensorFlow framework network performs training or online inference on the Ascend platform, the priority of the ASCEND_RT_VISIBLE_DEVICES environment variable is higher than that of ASCEND_DEVICE_ID. If ASCEND_DEVICE_ID and ASCEND_RT_VISIBLE_DEVICES are used together, ASCEND_DEVICE_ID can be set only to the device index value in ASCEND_RT_VISIBLE_DEVICES. Otherwise, the training or inference application runs abnormally.