blob: 283bd39a586d61b51e8bd45e13b0c302cb21ec51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
"""Helper methods related to the CPU"""
from __future__ import annotations
import multiprocessing
def auto_detect_cpus() -> int:
try:
n: int | None = multiprocessing.cpu_count()
except NotImplementedError:
n = None
return n if n else 1
__all__ = ("auto_detect_cpus",)
|