MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / get_machine_architecture

Function get_machine_architecture

scripts/test-simsimd-dispatch.py:5–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4
5def get_machine_architecture():
6 output = subprocess.check_output(["cat", "/proc/cpuinfo"])
7 flags_str = ""
8 for line in output.decode("utf-8").split("\n"):
9 line = line.strip()
10 if line.startswith("flags"):
11 flags_str = line
12 break
13 assert len(line) > 0
14
15 # Uses the same way as _simsimd_capabilities_x86() in simsimd.h to detect supported features
16 # The only simsimd functions we use in the vector index are cos/l2/l2_sq/dot which only branch for the targets 'skylake', 'haswell', and 'serial' so we only test for those
17 if "avx512f" in flags_str:
18 return "skylake"
19 elif "avx2" in flags_str and "f16c" in flags_str and "fma" in flags_str:
20 return "haswell"
21 else:
22 return "serial"
23
24
25bp = gdb.Breakpoint(f"simsimd_l2_f32_{get_machine_architecture()}")

Callers 1

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected