MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / get_cpu_affinity_or_count_fallback

Function get_cpu_affinity_or_count_fallback

benchmarks/frameworks/common.py:497–504  ·  view source on GitHub ↗

Get the number of CPU cores available or the current CPU affinity.

()

Source from the content-addressed store, hash-verified

495
496
497def get_cpu_affinity_or_count_fallback() -> int:
498 """Get the number of CPU cores available or the current CPU affinity."""
499 if platform.system() in ("Linux", "Windows"):
500 try:
501 return len(psutil.Process().cpu_affinity())
502 except Exception:
503 return os.cpu_count() or 4
504 return os.cpu_count() or 4
505
506
507def set_memory_binding(node: Optional[int]) -> None:

Callers 1

setupMethod · 0.85

Calls 1

systemMethod · 0.80

Tested by

no test coverage detected