Skip to content

Instantly share code, notes, and snippets.

@wckdouglas
Created December 10, 2015 23:53
Show Gist options
  • Save wckdouglas/7f1456dae6bbcc03350f to your computer and use it in GitHub Desktop.
Save wckdouglas/7f1456dae6bbcc03350f to your computer and use it in GitHub Desktop.
#!/bin/env python
from multiprocessing import Pool, Manager
import numpy as np
def tryFunc(i, j,results):
results.append(i*j)
def main():
a = 10
b = np.arange(10)
p = Pool(4)
results = Manager().list([])
for i in b:
p.apply(tryFunc, (a,i, results))
for i in results:
print i
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment