Skip to content

Commit 047a759

Browse files
authored
Add index to HPU devices (#7497)
The [PR #7266](#7266) enforces the devices having explicit device indices (i.e. 'hpu:0', 'cuda:0', etc). This PR aligns HPU devices to the requirement. Signed-off-by: Max Kovalenko <mkovalenko@habana.ai>
1 parent 8cf5fc5 commit 047a759

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

accelerator/hpu_accelerator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ def handles_memory_backpressure(self):
5454
return True
5555

5656
def device_name(self, device_index=None):
57-
# ignoring device_index.
58-
return 'hpu'
57+
if device_index is None:
58+
return self._name
59+
return '{}:{}'.format(self._name, device_index)
5960

6061
def device(self, device_index=None):
6162
return torch.device(self.device_name(device_index))

0 commit comments

Comments
 (0)