Skip to content

Commit 4f77a7b

Browse files
committed
better handling AMD GPUs
1 parent 855743e commit 4f77a7b

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

llm_benchmark/systeminfo/sysmain.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,29 @@ def get_disk_info():
5555
ans['free_disk_space'] = f"{disk_info.free}"
5656
ans['disk_space_utilization'] = f" {disk_info.percent:.2f}%"
5757

58+
# AMD GPU on Linux Only
59+
def get_gpu_names_rocminfo():
60+
try:
61+
result = subprocess.run(['rocminfo'], capture_output=True, text=True, timeout=10)
62+
if result.returncode != 0:
63+
return None
64+
65+
gpu_names = []
66+
lines = result.stdout.split('\n')
67+
68+
for line in lines:
69+
# Marketing Name is the most user-friendly identifier
70+
if 'Marketing Name:' in line:
71+
name = line.split('Marketing Name:')[1].strip()
72+
73+
if name and name != 'N/A' and "Intel" not in name:
74+
gpu_names.append(name)
75+
76+
return gpu_names
77+
except Exception as e:
78+
print(f"rocminfo failed: {e}")
79+
return None
80+
5881
#Only Nvidia GPU on Windows and Linux
5982
def get_gpu_info():
6083

@@ -66,7 +89,7 @@ def get_gpu_info():
6689
gpus = GPUtil.getGPUs()
6790

6891
if not gpus:
69-
print("\nNo GPU detected.")
92+
print("\nNo NVIDIA GPU detected.")
7093
ans['0'] = "no_gpu"
7194
else:
7295
ans['0'] = "there_is_gpu"
@@ -178,7 +201,22 @@ def get_extra():
178201
if ('product' in line):
179202
ans['gpu']=f"{line[16:]}"
180203
except:
181-
ans['gpu']="no_gpu"
204+
try:
205+
amd_gpus = get_gpu_names_rocminfo()
206+
if (amd_gpus is None):
207+
raise Exception("No AMD GPUs")
208+
209+
amd_ans={}
210+
amd_ans['0'] = "there_is_amd_gpu"
211+
212+
for i, gpu in enumerate(amd_gpus):
213+
#print(f"\nGPU {i + 1} Information:")
214+
amd_ans[f'{i+1}'] = {}
215+
amd_ans[f'{i+1}']['id'] = f"{i}"
216+
amd_ans[f'{i+1}']['name'] = f"{gpu}"
217+
ans['gpu'] = get_linux_gpu_names(amd_ans)
218+
except:
219+
ans['gpu']="no_gpu"
182220
else :
183221
print(f"{get_gpu_info()['1']}")
184222
try:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "llm_benchmark"
3-
version = "0.4.7"
3+
version = "0.4.8"
44
description = "LLM Benchmark for Throughputs via Ollama"
55
authors = ["Jason Chuang <[email protected]>"]
66
license = "MIT"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exceptiongroup==1.2.0
88
fake-winreg==1.6.3
99
GPUtil==1.4.0
1010
h11==0.16.0
11-
httpcore==1.0.5
11+
httpcore==1.0.9
1212
httpx==0.27.0
1313
idna==3.7
1414
lib-detect-testenv==2.0.8

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='llm_benchmark',
8-
version='0.4.7',
8+
version='0.4.8',
99
author='Jason Chuang',
1010
author_email='[email protected]',
1111
description='LLM Benchmark',

0 commit comments

Comments
 (0)