Skip to content

Commit

Permalink
parse verbose info from gpu name
Browse files Browse the repository at this point in the history
  • Loading branch information
pennybelle committed Oct 4, 2024
1 parent 802bbda commit 4df038b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pbfetch/parse/gpu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from subprocess import Popen, PIPE
from re import sub
# import nvidia_smi


Expand Down Expand Up @@ -30,7 +31,7 @@ def parse_gpu():
if gpu_name:
gpu_name = gpu_name.split(": ")[1]
gpu_name = gpu_name.strip()
return gpu_name
return sub(r"\(.+\)$", "", gpu_name.strip())

except Exception:
pass
Expand All @@ -45,7 +46,7 @@ def parse_gpu():
gpu_name = gpu_name.replace("OpenGL compatibility profile renderer: ", "")
# print(gpu_name)

return gpu_name
return sub(r"\(.+\)$", "", gpu_name.strip())

except Exception:
pass
Expand All @@ -63,7 +64,7 @@ def parse_gpu():
gpu_name = gpu_name[2 : len(gpu_name) - 3]
gpu_name = gpu_name.split("VGA compatible controller:")[1].strip()

return gpu_name
return sub(r"\(.+\)$", "", gpu_name.strip())

except Exception as e:
print(f"GPU Parse Error: {e}")
Expand Down

0 comments on commit 4df038b

Please sign in to comment.