Esempio n. 1
0
def detect_ncpus():
    """Detects the number of effective CPUs in the system"""
    if iswindows:
        import win32api
        ans = win32api.GetSystemInfo()[5]
    else:
        import multiprocessing
        ans = -1
        try:
            ans = multiprocessing.cpu_count()
        except Exception:
            from PyQt5.Qt import QThread
            ans = QThread.idealThreadCount()
    return max(1, ans)
Esempio n. 2
0
def detect_ncpus():
    """Detects the number of effective CPUs in the system"""
    if iswindows:
        import win32api
        ans = win32api.GetSystemInfo()[5]
    else:
        import multiprocessing
        ans = -1
        try:
            ans = multiprocessing.cpu_count()
        except Exception:
            from PyQt5.Qt import QThread
            ans = QThread.idealThreadCount()
    return max(1, ans)