()
| 118 | |
| 119 | |
| 120 | def 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 | |
| 141 | def get_cuda_version(): |