[Numpy-discussion] numpy/Windows shared arrays between processes?

Ray S subscriber100@rjs....
Tue Oct 9 16:32:45 CDT 2007


On 10/9/07, Sebastian Haase replied:
 > > Did you find that locks
 > > or semaphores were needed?
 > Maybe that's why it crashed ;-) !?  But for simple use it seems 
fine.

I just did some code (below) that does read/write to the array AFAP, 
and there is no crash, or any other issue (Win2000, py2.4, numpy 
1.0b1).
Without the print statements, it does max both processors; with 
printing I/O only 58%.
Both processes can modify the array without issue either.
I'll experiment with

I had seen the Win mmap in this thread:
http://objectmix.com/python/127666-shared-memory-pointer.html
and here:
http://www.codeproject.com/cpp/embedpython_2.asp

Note also that the Python mmap docs read "In either case you must 
provide a file descriptor for a file opened for update." and no 
mention of the integer zero descriptor option.
Access options behave as presented.

Because *NIX has MAP_SHARED as an option you'd think that there might 
be cross-platform share behavior with some platform checking if 
statements. Without a tag though, how does another process reference 
the same memory on NIX, a filename? (It seems)

 > > But I had the same
 > > issue as Mark Heslep
 > > 
http://aspn.activestate.com/ASPN/Mail/Message/ctypes-users/3192422
 > > of creating a numpy array from a raw address (not a c_array).
 >I assume this is a different issue, but haven't looked into it yet.

Yes, a different methodology attempt. It would be interesting to know 
anyway how to create a numpy array from an address; it's probably 
buried in the undocumented C-API that I don't grok, and likely 
frowned upon.

Thanks,
Ray



More information about the Numpy-discussion mailing list