Created
November 1, 2015 00:06
-
-
Save cgoldberg/bef7d5df55ec74f1241e to your computer and use it in GitHub Desktop.
Find the number of CPU cores (Linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def num_cpu_cores(): | |
with open('/proc/cpuinfo') as f: | |
return f.read().count('processor') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment