In view of randomized structure of my algorithm, I want to run it hundreds of times in parallel. Parameters stay the same every time.
Both of implementations raise some kind of exception (PicklingError, or TypeError).
from multiprocessing import Pool
from itertools import izip, repeat
if __name__ == '__main__':
G = Class1Object()
S = Class2Object()
pool = multiprocessing.Pool(processes=multiprocessing.cpu_count())
# take 1 tuple input
# parfun = lambda (G,S): fun(G,S)
# T = pool.map(parfun, izip(repeat(G, 2), repeat(S, 2)))
# take 2 arguments
T = pool.map(fun, [G]*2, [S]*2)
What is the fastest and most convenient way to run function with multiple arguments in parallel?