import numpy as np
from scipy import optimize
from multiprocessing import Pool

def square(x, a=1):
    return [np.sum(x ** 2 + a), 2 * x]

def minimize(args):
    f, x, a = args
res = optimize.minimize(f, x, method='BFGS', jac=True, args=[a])
return res.x
a = np.arange(1, 11)
x = np.empty(len(a))
x[:] = 25
args = [(square, a[i], x[i]) for i in range(10)]
p = Pool(4)
print(p.map(minimize, args))
Parallel optimizations in SciPy