Skip to content

Instantly share code, notes, and snippets.

@michaelguia
Created June 7, 2018 02:24
Show Gist options
  • Save michaelguia/2fdf74153bfc8a6a45733674e920bd93 to your computer and use it in GitHub Desktop.
Save michaelguia/2fdf74153bfc8a6a45733674e920bd93 to your computer and use it in GitHub Desktop.
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