Skip to content

Commit c697539

Browse files
committed
DEBUG: capture runner CPU brand + numpy baseline/dispatch in probe
1 parent 2bf443a commit c697539

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

ci_debug/ft_repro.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,47 @@ def run(label, fn):
4848
print(" %-46s -> ERROR %s: %s" % (label, type(e).__name__, e))
4949

5050

51+
def cpu_info():
52+
import platform
53+
lines = []
54+
try:
55+
import numpy._core._multiarray_umath as _mu
56+
lines.append(" numpy baseline : %s" % (getattr(_mu, "__cpu_baseline__", "?"),))
57+
lines.append(" numpy dispatch : %s" % (getattr(_mu, "__cpu_dispatch__", "?"),))
58+
except Exception as e: # noqa: BLE001
59+
lines.append(" numpy cpu features : <err %s>" % e)
60+
lines.append(" platform.processor : %r" % platform.processor())
61+
lines.append(" platform.machine : %r" % platform.machine())
62+
lines.append(" PROCESSOR_IDENTIFIER: %r" % os.environ.get("PROCESSOR_IDENTIFIER"))
63+
brand = None
64+
for cmd in (
65+
["powershell", "-NoProfile", "-Command", "(Get-CimInstance Win32_Processor).Name"],
66+
["wmic", "cpu", "get", "name"],
67+
):
68+
try:
69+
out = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
70+
txt = " / ".join(
71+
ln.strip() for ln in out.stdout.splitlines()
72+
if ln.strip() and ln.strip() != "Name"
73+
)
74+
if txt:
75+
brand = txt
76+
break
77+
except Exception: # noqa: BLE001
78+
continue
79+
lines.append(" CPU brand : %r" % (brand,))
80+
return "\n".join(lines)
81+
82+
5183
TAG = "FT" if not gil_enabled() else "GIL"
5284

5385
print("\n########## quaddtype win-ft probe [%s] ##########" % TAG)
5486
print("python : %s gil_enabled=%s" % (sys.version.split()[0], gil_enabled()))
5587
print("numpy : %s" % np.__version__)
5688
print("quaddtype : %s" % getattr(nq, "__version__", "?"))
5789
run("is_longdouble_128", nq.is_longdouble_128)
90+
print("[%s] CPU / SIMD environment:" % TAG)
91+
print(cpu_info())
5892

5993
print("[%s] PURE numpy special-value checks (NO quaddtype involved):" % TAG)
6094
run("np.isinf(float('inf'))", lambda: np.isinf(float("inf")))

0 commit comments

Comments
 (0)