Multiprocessing.Array bug / shared numpy array
robert.kern at gmail.com
Thu Oct 8 23:02:00 CEST 2009
On 2009-10-08 15:14 PM, Felix wrote:
> I am trying to create a shared, read-only numpy.ndarray between
> several processes. After some googling the basic idea is:
> sarr = mp.Array('i',1000)
> ndarr = scipy.frombuffer(sarr._obj,dtype='int32')
> Since it will be read only (after being filled once in a single
> process) I don't think I need any locking mechanism. However is this
> really true given garbage collection, reference counts and other
> implicit things going on?
> Or is there a recommended better way to do this?
I recommend using memory-mapped arrays for such a purpose.
You will want to ask further numpy questions on the numpy mailing list:
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list