Handle case with no GPUs
Change-Id: I35b8d4d0c0b6e63d9851d56163686794c7bb8c1e
[ROCm/rocminfo commit: d8f236cd81]
Αυτή η υποβολή περιλαμβάνεται σε:
@@ -190,24 +190,25 @@ def readFromKFD():
|
||||
target_list = []
|
||||
|
||||
topology_dir = '/sys/class/kfd/kfd/topology/nodes/'
|
||||
for node in sorted(os.listdir(topology_dir)):
|
||||
node_path = os.path.join(topology_dir, node)
|
||||
if os.path.isdir(node_path):
|
||||
prop_path = node_path + '/properties'
|
||||
if os.path.isfile(prop_path):
|
||||
target_search_term = re.compile("gfx_target_version.+")
|
||||
with open(prop_path) as f:
|
||||
line = f.readline()
|
||||
while line != '' :
|
||||
search_result = target_search_term.search(line)
|
||||
if search_result is not None:
|
||||
device_id = int(search_result.group(0).split(' ')[1], 10)
|
||||
if device_id != 0:
|
||||
major_ver = int((device_id / 10000) % 100)
|
||||
minor_ver = int((device_id / 100) % 100)
|
||||
stepping_ver = int(device_id % 100)
|
||||
target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x'))
|
||||
if os.path.isdir(topology_dir):
|
||||
for node in sorted(os.listdir(topology_dir)):
|
||||
node_path = os.path.join(topology_dir, node)
|
||||
if os.path.isdir(node_path):
|
||||
prop_path = node_path + '/properties'
|
||||
if os.path.isfile(prop_path):
|
||||
target_search_term = re.compile("gfx_target_version.+")
|
||||
with open(prop_path) as f:
|
||||
line = f.readline()
|
||||
while line != '' :
|
||||
search_result = target_search_term.search(line)
|
||||
if search_result is not None:
|
||||
device_id = int(search_result.group(0).split(' ')[1], 10)
|
||||
if device_id != 0:
|
||||
major_ver = int((device_id / 10000) % 100)
|
||||
minor_ver = int((device_id / 100) % 100)
|
||||
stepping_ver = int(device_id % 100)
|
||||
target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x'))
|
||||
line = f.readline()
|
||||
|
||||
return target_list
|
||||
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user