Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get cpu count in python

1
import os
2
workers = os.cpu_count()
3
if 'sched_getaffinity' in dir(os):
4
    workers = len(os.sched_getaffinity(0))
5
​
Source by pyquestions.com #
 
PREVIOUS NEXT
Tagged: #cpu #count #python
ADD COMMENT
Topic
Name
2+5 =