get_device_group_id

get_device_group_id(device_id, backend_name='')

Retrieves the logical device group ID for a Houmo device.

The function returns:

  • For a backend with a card-level topology, such as Houmo M50 series devices:

    • The specified device is not connected to any other device through CTC:

      Each device is assigned to its own logical device group and has a distinct group ID.

    • The specified device belongs to a CTC-connected device group:

      Each group of Houmo devices interconnected through CTC is represented as a card and assigned a card ID. Devices in the same group share the same card ID. This function returns the card ID as the logical device group ID.

  • For a backend without a card-level topology, such as Houmo M30 series devices:

    This function returns the device ID. Each device is treated as a separate group.

  • If the device ID or backend name is invalid, or if the logical device group cannot be determined, the function returns a negative value.

Notes

  • The value is served from the topology cached by the backend and is intended for grouping and comparison only. It must not be passed to DevManager as a device ID.

  • When an inference requires devices to communicate through CTC, all devices used for the inference must have the same logical device group ID returned by this function.

  • This logical device group ID represents a device group at the Runtime level. It is distinct from the Group ID returned by SMI, which identifies a CTC interconnect domain. Do not use the two IDs interchangeably.

Parameters:
  • device_id (int) -- The logical device ID.

  • backend_name (str) -- The backend name. An empty string uses the default backend.

Returns:

group_id -- The logical device group ID, served from the topology cached by the backend. See the return value semantics above.

Return type:

int