Functions
GetDeviceChipId
-
int tcim::GetDeviceChipId(int device_id, const std::string &backend_name = "")
Retrieves the logical chip ID of 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: The function returns the logical chip ID associated with the specified device. Each chip within the same Houmo device has a distinct logical chip ID.
The specified device belongs to a CTC-connected device group: The function returns the chip index of the specified device within the group. The returned value corresponds to the low 16 bits of the raw chip ID. Devices in the same card have distinct logical chip IDs.
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 chip ID cannot be determined, the function returns a negative value.
Note
The value is served from the topology cached by the backend at initialization. It is intended only for identification and comparison and must not be passed to DevManager as a device ID.
When an inference requires devices to communicate through CTC, all chips used for inference must belong to the same logical device group, and the logical chip IDs must be consecutive, such as {0, 1}, {2, 3}, or {2, 3, 4}. Otherwise, a runtime error occurs.
- Parameters:
device_id -- [in] The logical device ID accepted by GetDeviceNum() and DevManager.
backend_name -- [in] The backend name. An empty string uses the default backend.
- Returns:
A logical chip ID. See the return value semantics above.
GetDeviceGroupId
-
int tcim::GetDeviceGroupId(int device_id, const std::string &backend_name = "")
Retrieves the logical device group ID of 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.
Note
The value is served from the topology cached by the backend at initialization. It is intended only for grouping and comparison and 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 -- [in] The logical device ID accepted by GetDeviceNum() and DevManager.
backend_name -- [in] The backend name. An empty string uses the default backend.
- Returns:
A logical device group ID. See the return value semantics above.
GetDeviceNum
-
int64_t tcim::GetDeviceNum(const std::string &backend_name = "")
Retrieves the number of Houmo devices with the specified backend name.
- Parameters:
backend_name -- [in] The name of the backend. You can get the backend name via GetSupportedBackend or Module::GetBackendName. If set the value to
"", the default backend is used for query.- Returns:
Returns the number of Houmo devices with the backend name.
GetSupportedBackend
-
const std::vector<std::string> &tcim::GetSupportedBackend()
Retrieves the list of backend names supported by the current Houmo device.
- Returns:
Returns the supported list of backend names.
GetVersion
-
const std::string &tcim::GetVersion()
Retrieves the version and release date of the TCIM library.
The version of TCIM library is composed of major, minor and patch. For instance, major = 2, minor = 0, patch = 0, and release date is Nov 11 2024, this API returns
2.0.0 Nov 11 2024.- Returns:
Returns the version and release date of the TCIM library.
operator<<
-
std::ostream &tcim::operator<<(std::ostream &os, const Status &status)
RegisterLogHandler
-
Status tcim::RegisterLogHandler(std::unique_ptr<LogHandler> &&handler)
Registers a custom log handler to intercept runtime library logs.
Notes
This API supports multiple invocations. The most recent call to this API will replace the previous handler and take effect for subsequent logging events.
This API is not thread-safe. You must ensure that no other TCIM APIs are being invoked concurrently during the registration process to avoid race conditions or undefined behavior.
This function accepts a
std::unique_ptr, meaning ownership is transferred to the library. The caller should not attempt to access the handler object after registration.
- Parameters:
handler -- [in] A unique pointer to the user-defined
LogHandlerinstance. Must not be null.- Returns:
Status::OK if registration succeeds, or an error status otherwise.