I want to execute a symmetric lambda function in parallel. I dont know:
- why does it work in parallel, although this is a lambda function
- why it stops working when I try to execute without a pool.
- why does it work if i uncomment the first return in
lambdify
And, obviously, the markdown preprocessor requires a line of text above the code, so this is code:
from multiprocessing import Pool import sympy from sympy.abc import x def f(m): return m.lambdify()(1) class Mult(): def lambdify(self):
He prints:
[2] [2] 2 PicklingError: Can't pickle <function <lambda> at 0x000000000DF0D048>: attribute lookup <lambda> on numpy failed
(I cut the trace)
If I uncomment, it works fine:
[2] [2] 2 [2]
I tested only on Windows, and it works exactly the same as "numexpr" instead of "numpy".
source share