aclrtGetUserDevIdByPhyDevId

Applicability

Product

Supported

Ascend 910D AI Processor

√

Atlas A3 Training Series Product

√

Atlas A2 Training Series Product/Atlas 800I A2 Inference Product

√

Atlas 200/500 A2 Inference Product

√

Atlas Inference Series Product

√

Atlas Training Series Product

√

Function

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

Prototype

1
aclError aclrtGetUserDevIdByPhyDevId(const int32_t phyDevId, int32_t *const userDevId)

Parameters

Parameter

Input/Output

Description

phyDevId

Input

Physical device ID.

userDevId

Output

User device ID.

Returns

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

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

If the ASCEND_RT_VISIBLE_DEVICES 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 figure below, the ASCEND_RT_VISIBLE_DEVICES 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.