[Python-3000] Single buffer implied in new buffer protocol?
Lisandro Dalcin
dalcinl at gmail.com
Wed May 28 16:35:06 CEST 2008
On 5/27/08, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Travis Oliphant wrote:
>
> > Obviously, if you haven't provided a Py_buffer structure to fill in, then
> you are only asking to lock the object's buffer from other access.
> >
>
> What's the use case for that? Why would you ever want
> to lock an object if you don't intend to access it?
>
Well, iff we already accessed the object, had stored the raw memory
pointer, and hold a reference to it, and now we want other thread to
operate on the raw memory, does not make sense to just lock the
object?
In the context of MPI communication, I believe I have a use case,
using something called persistent communication requests. You emit a
Comm.Recv_init() call with the pointer to the buffer receiving the
message (then you have to ask the object for the buffer pointer). The
Comm.Recv_init() returns a 'Prequest' instance (persistent request),
but the actual communication does not initiate until you call
Prequest.Start(). Then when you initiate the communication, we should
lock the object until the communication finalizes, because then we
could release the GIL but protect the raw memory from other accesses.
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
More information about the Python-3000
mailing list