Created
December 23, 2017 08:20
-
-
Save philipperemy/3daadd0a99cec5bd3092554aaf5e765c to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
""" | |
Produces load on all available CPU cores | |
""" | |
from multiprocessing import Pool | |
from multiprocessing import cpu_count | |
def f(x): | |
while True: | |
x*x | |
if __name__ == '__main__': | |
processes = cpu_count() | |
print 'utilizing %d cores\n' % processes | |
pool = Pool(processes) | |
pool.map(f, range(processes)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment