Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Created November 1, 2015 00:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cgoldberg/bef7d5df55ec74f1241e to your computer and use it in GitHub Desktop.
Save cgoldberg/bef7d5df55ec74f1241e to your computer and use it in GitHub Desktop.
Find the number of CPU cores (Linux)
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