mindspore.hal.get_device_name

mindspore.hal.get_device_name(device_id, device_target=None)[source]

Get specified device’s name.

Note

If device_target is not specified, get the device name of the current backend set by context. This method always returns “CPU” for CPU backend.

Parameters
  • device_id (int) – The device id of which the name will be returned.

  • device_target (str, optional) – The device name of backend, should be one of “CPU”, “GPU” and “Ascend”.

Returns

str.

Examples

>>> import mindspore as ms
>>> device_target = ms.context.get_context("device_target")
>>> print(ms.hal.get_device_name(0, device_target))