Created
April 12, 2017 14:41
-
-
Save mperlet/213551d5853efdd9d0c2fd3006313b88 to your computer and use it in GitHub Desktop.
parallel python map function
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 pmap(func, iter, pool_size=4): | |
""" Like pythons map() function but parallel """ | |
from multiprocessing.dummy import Pool | |
return Pool(pool_size).map(func, iter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment