MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / get_xpu_model

Function get_xpu_model

fastdeploy/usage/usage_lib.py:120–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118
119
120def get_xpu_model():
121 try:
122 result = subprocess.run(["xpu-smi"], capture_output=True, text=True, timeout=5)
123
124 if result.returncode != 0:
125 return None
126
127 pattern = r"^\|\s*(\d+)\s+(\w+)\s+\w+"
128 lines = result.stdout.split("\n")
129
130 for line in lines:
131 match = re.search(pattern, line)
132 if match:
133 model = match.group(2)
134 return model
135
136 return "P800"
137 except Exception:
138 return "P800"
139
140
141def get_cuda_version():

Callers 5

test_command_failureMethod · 0.90
_report_usage_onceMethod · 0.85

Calls 2

splitMethod · 0.80
runMethod · 0.45

Tested by 4

test_command_failureMethod · 0.72