On 08.01.2018 16:25, Percy wrote:
> Greetings, Tiago!
> 
> I am trying to use the multiprocess module in Python to accelerate my
> simulations. Specifically, I use the following code to parallelly calculate
> k-shortest paths for a set of node pairs,
> 
> self.valid_paths[v] = pool.map(lambda x: gt.all_shortest_paths(self.g,source
> = v_index, target = x),[self.g.vertex_index[c] for c in self.Cloudlet]),
> 
> where self.Cloudlet is a predefined node list.

Please, provide a minimal _self-contained_ (i.e. complete) example that
shows the problem, not a snippet. Otherwise it is difficult to understand
the problem.

> However, python reports the pickling issues
>  self.valid_paths[v] = pool.map(lambda x:
> gt.all_shortest_paths(self.g,source = v_index, target =
> x),[self.g.vertex_index[c] for c in self.Cloudlet])
> 
> File
> "/home/percy/anaconda2/lib/python2.7/site-packages/multiprocess/pool.py",
> line 251, in map
>     return self.map_async(func, iterable, chunksize).get()
> 
> File
> "/home/percy/anaconda2/lib/python2.7/site-packages/multiprocess/pool.py",
> line 567, in get
>     raise self._value
> 
> RuntimeError: Pickling of "graph_tool.libgraph_tool_core.Vertex" instances
> is not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html)
> 
> Is there anything I am missing?

Vertex objects cannot be pickled. I assume that 'self.Cloudlet' stores a
list of Vertex objects. It should be changed to store a list of ints instead.

> My OS is 16.04, python 2.7.14, graph-tool is
> from Ostrokach's Anaconda.

Please say what version of graph-tool you are using.


-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to