Skip to content

Instantly share code, notes, and snippets.

@mcleary
Created April 13, 2016 15:30
Show Gist options
  • Save mcleary/e4ff32a01d9ef915941e0aa022e2d7b1 to your computer and use it in GitHub Desktop.
Save mcleary/e4ff32a01d9ef915941e0aa022e2d7b1 to your computer and use it in GitHub Desktop.
from multiprocessing import Pool
import math
import time
def func(param):
print 'Iniciando funcao para param=' + str(param)
k = 0.0
for i in range(0, 1000000*param):
k += math.sin(i) * math.sqrt(i) * math.pow(i, 20)
return k
if __name__ == '__main__':
pool = Pool(4)
t0 = time.time()
print pool.map(func, [i for i in range(0, 5)])
print time.time() - t0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment