memory position of numpy arrays

Andrew Straw strawman at astraw.com
Tue Oct 24 12:10:22 CDT 2006


David Cournapeau wrote:
> I don't know anything about your device, but a driver directly accessing 
> a memory buffer from a userland program sounds like a bug to me. 
David, DMA memory (yes, I know thats an example of RAS Syndrome,
apologies) allows hardware to fill a chunk of RAM and then hand it over
to a userspace program. In my experience, RAM used for this purpose must
be pre-allocated, usually in a ring-buffer type arrangement. So this is
normal operating procedure for something like a frame grabber and not a
bug at all.

However, the fact that Lars is able to elicit blue screens from a
user-mode program indicates driver bugs to me. It's likely, however,
that once he gets his program operating within the bounds of what the
developers tested, it'll work fine.

Lars, for now I suggest doing what AM Archibald suggests and doing a
memcpy to copy your framebuffers immediately into non-DMA memory and
then hand that DMA memory back to the hardware driver. (Typically these
drivers have function calls that indicate whether you "own" that part of
memory -- this is, confusingly also called "locking" in the thread
sense, as opposed to "locking" in the memory page sense.)

Finally, whether you allocate memory in C or in numpy makes little
difference. But if you want to use numpy, empty() will be presumably
faster than zeros(). And it will have the advantage of doing memory
management via Python's standard ref-counting.

Cheers!
Andrew

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list