Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Created June 7, 2014 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccorcos/07398ae92c9ab305fb65 to your computer and use it in GitHub Desktop.
Save ccorcos/07398ae92c9ab305fb65 to your computer and use it in GitHub Desktop.
parallel processing in python
from multiprocessing import Pool
def f(x):
print x
return x**2
if __name__ == '__main__':
# 8 processors
p = Pool(8)
a = range(100)
b = p.map(f, a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment