Created
June 7, 2018 02:24
-
-
Save michaelguia/2fdf74153bfc8a6a45733674e920bd93 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
from multiprocessing import Pool | |
from time import sleep | |
import numpy as np | |
def sum_list(numbers): | |
return sum(numbers) | |
master_list = np.arange(100000000).reshape(2,50000000) | |
l1 = [3, 5, 7] | |
l2 = [4, 6, 8] | |
# master_list = [l1, l2] | |
#result = map(lambda l: sum_list(l), master_list) | |
#print(list(result)) | |
pool = Pool(processes=3) | |
results = pool.map(sum_list, master_list) | |
print(list(results)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment