aclrtGetUserDevIdByLogicDevId

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Obtains the user device ID based on the logical device ID.

Prototype

aclError aclrtGetUserDevIdByLogicDevId(const int32_t logicDevId, int32_t *const userDevid)

Parameters

Parameter

Input/Output

Description

logicDevId

Input

Logical device ID.

userDevid

Output

User device ID.

Returns

0 on success; else, failure. For details, see aclError.

Relationships Between the User Device ID, Logical Device ID, and Physical Device ID

If the ASCEND_RT_VISIBLE_DEVICE environment variable is not set, the logical device ID is the same as the user device ID. In a non-container scenario, the physical device ID is the same as the logical device ID.

In the following figure, the ASCEND_RT_VISIBLE_DEVICE environment variable is set in the container scenario. The relationships between the three IDs are as follows: The device IDs set through the ASCEND_RT_VISIBLE_DEVICES environment variable are 1 and 2, and the corresponding device indexes are 0 and 1. The user device ID set through aclrtSetDevice is 0, and the corresponding device index is 0. Therefore, the user device ID 0 corresponds to the logical device ID 1, and the logical device ID 1 in the container is mapped to the physical device ID 6. Finally, the physical device with ID 6 is used for computation.

For details about ASCEND_RT_VISIBLE_DEVICES, see Environment Variables.