[SciPy-user] shared memory machines

Philip Semanchuk philip@semanchuk....
Sun Feb 8 18:22:20 CST 2009


On Feb 8, 2009, at 7:00 PM, Gael Varoquaux wrote:

> On Fri, Feb 06, 2009 at 10:22:53PM +0100, Sturla Molden wrote:
>>
>> Ok, so this is approximately what I had in mind for Windows. It is  
>> a named
>> mutex and shared memory that is pickled by name (given that I read  
>> the
>> Python manuals on pickling extension objects correctly...)
>>
>> It still lacks an ndarray subclass that is pickled without making a  
>> copy of
>> the buffer, and also a malloc similar to multiprocessing.
>>
>> And similar Cython code has to be written for posix...
>
> OK, I've given it try, but it seems that my sheer incompetence on  
> these
> matters is about to be revealed. Running the attached test code, I  
> get a
> bus error. The output of test.py is:
>
> {'/c0aa50edb5a04371b8414ef16a49a4fa': (3070545920L, 409600)}
> Buffer created
> Array created
> 3070545920
> [1]    9882 bus error  python test.py
>
> I am quite clueless as to where this comes from (I can see different
> posibilities) and how to debug this.
>
> Once again, this is from sheer incompetence, but I have never mmaped
> files throught the C API, and my days of C, especially memory  
> allocation
> in C, are very far.

Hi Gaël,
I believe one must call ftruncate() on the file handle returned by  
shm_open(). Look at the example at the bottom of this page:
http://www.opengroup.org/onlinepubs/000095399/functions/shm_open.html

I hope this info is useful.

Philip




More information about the SciPy-user mailing list