I need to run in parallel multiple functions. I tried this
from multiprocessing import Pool
def smap(f, *args):
return f(*args)
def somma(*args):
a=args[0]
b=args[1]
return a+b
def prodotto(*args):
a=args[0]
b=args[1]
return a*b
pool = Pool(processes=2)
a=2
b=4
res=pool.map(smap, [(somma,a,b),(prodotto,a,b)])
print(res)
with the following error:
TypeError: 'tuple' object is not callable
What's wrong?