Pickling a Swig object for parallelization

19 Views Asked by At

I'm trying to use Ray to parallelize a function that returns a Swig object. However, I receive the error:
cannot pickle 'SwigPyObject' object.

The object I am trying to return is:
<xyz.abc; proxy of <Swig Object of type 'boost::shared_ptr<a::b::c::d<a::b::e::f::g > > *' at 0x000021F....> >.

import numpy as np
import ray
import ray.util.multiprocessing import Pool

def f(x):
     return SwigPyObject

def my_func_par(large_list):
     return pool.map(f, large_list)

my_list = ["a", "b", ..... "z"]
print(my_func_par(my_list))
0

There are 0 best solutions below