I am trying to parallelize a code that must evaluate a specific function on several different inputs.
The function is obtained by taking a (really big) symbolic expression and calling the method fast_callable on it. Now, what I need to do is to "describe" the function to all the compute nodes. Unfortunately, I can not find a way to pickle the wrapper that fast_callable returns.
Indeed, if I try the following
from pickle import dumps
a = x^2 + 3 * x
b = fast_callable(a, vars=(x,))
dumps(b)
I get
TypeError: cannot pickle 'sage.ext.interpreters.wrapper_py.Wrapper_py' object
I have tried with pickle, with cPickle, with dill and with SagePickler, with no luck. Is there any way to export the callable objects? Otherwise, is there an easy workaround for this? The only one that I come out with would be to pass the symbolic expression instead of passing the output of fast_callable but, taking into account that it takes more that 15 minutes to execute the fast_callable function on my symbolic expression, this will neglect any improvement that I get from parallelizing my code.