[Numpy-discussion] pickling/unpickling numpy.void and numpy.record for multiprocessing

Martin Spacek numpy at mspacek.mm.st
Fri Feb 26 20:37:08 EST 2010


On 2010-02-26 15:02, Robert Kern wrote:
>> Is this a known limitation?
>
> Nope. New bug! Thanks!

Good. I'm not crazy after all :)

> Pickling of complete arrays works. A quick workaround would be to send
> rank-0 scalars:
>
>    Pool.map(map(np.asarray, x))
>
> Or just tuples:
>
>    Pool.map(map(tuple, x))

Excellent! The first method works as a drop-in replacement for me. Seems better 
than the second, because it conserves named field access. The only slight 
difference is this:

 >>> a = map(np.asarray, x)
 >>> a[0]['f0']
array(1)
 >>> x[0]['f0']
1

...but that doesn't seem to affect my code. Thanks a bunch for the quick solution!

Martin




More information about the NumPy-Discussion mailing list