Add more GPU information in the results file
Browse files- bench-TriLMs.py +13 -6
bench-TriLMs.py
CHANGED
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
6 |
from urllib import request
|
7 |
import os
|
8 |
import shlex
|
|
|
9 |
import subprocess
|
10 |
import sys
|
11 |
from typing import Any, Sequence
|
@@ -208,15 +209,21 @@ if __name__ == "__main__":
|
|
208 |
mulmat_perf.append(test_backend_perf())
|
209 |
results.extend(llama_bench(repetitions=repetitions, types=GPU_TYPES))
|
210 |
|
211 |
-
|
212 |
-
encoding="utf-8"
|
213 |
-
)
|
214 |
-
|
215 |
-
final_result = {
|
216 |
-
"cpuinfo": cpuinfo,
|
217 |
"mulmat_perf": mulmat_perf,
|
218 |
"results": results,
|
219 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
logger.info("Writing output to: %s", output_file)
|
221 |
logger.debug("Final results: %s", json.dumps(final_result, indent=4))
|
222 |
with open(output_file, "w") as f:
|
|
|
6 |
from urllib import request
|
7 |
import os
|
8 |
import shlex
|
9 |
+
import shutil
|
10 |
import subprocess
|
11 |
import sys
|
12 |
from typing import Any, Sequence
|
|
|
209 |
mulmat_perf.append(test_backend_perf())
|
210 |
results.extend(llama_bench(repetitions=repetitions, types=GPU_TYPES))
|
211 |
|
212 |
+
final_result: dict[str, Any] = {
|
|
|
|
|
|
|
|
|
|
|
213 |
"mulmat_perf": mulmat_perf,
|
214 |
"results": results,
|
215 |
}
|
216 |
+
|
217 |
+
if shutil.which("lscpu") is not None:
|
218 |
+
logger.info("Getting CPU info")
|
219 |
+
final_result["cpuinfo"] = subprocess.run(["lscpu"], capture_output=True).stdout.decode(
|
220 |
+
encoding="utf-8"
|
221 |
+
)
|
222 |
+
|
223 |
+
if args.gpu and shutil.which("nvidia-smi") is not None:
|
224 |
+
logger.info("Getting NVIDIA GPU info")
|
225 |
+
final_result["gpuinfo"] = subprocess.run(["nvidia-smi", "-q"], capture_output=True).stdout.decode(encoding="utf-8")
|
226 |
+
|
227 |
logger.info("Writing output to: %s", output_file)
|
228 |
logger.debug("Final results: %s", json.dumps(final_result, indent=4))
|
229 |
with open(output_file, "w") as f:
|