You can use Pool.starmap() instead of Pool.map() to pass multiple arguments. The function is as follows:
starmap(func, iterable[, chunksize])
Here is an example that uses starmap().
from multiprocessing import Pool
import numpy as np
def func(x, y):
return x + y
a = [11, 12, 13, 14, 15, 16, 17]
b = [1, 2, 3, 4, 5, 6, 7]
with Pool(2) as pool:
v = pool.starmap(func, [(a[j], b[j]) for j in range(len(a))])
print(v)
In the above example, I am passing 2 arguments, a[j] and b[j], to the function func(). The output of the code is the following:
[12, 14, 16, 18, 20, 22, 24]