Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Lisandro Dalcin (dalcinl_at_[hidden])
Date: 2006-10-19 19:14:51


As a general idea and following similar MPI concepts, it can be really
useful if MPI_BUFFER_ATTACH/DETACH allowed a layered usage, inside
modules. That is, inside a call, a library can make a 'detach' and
cache it, next 'attach' an internally allocated resource, call BSEND,
'detach' it own resources, and finaly re-'attach' the original
resources. I've already disccussed this a bit with Bill Gropp,
regarding MPICH2 behaviour.

So I would to propose the following:

1- MPI_BUFFER_ATTACH should attach the provided buffer, raising an
error if the provided size is less than BSEND_OVERHEAD (why to
postpone the error until MPI_Bsend?). Currently, the behavior is:

In [1]: from mpi4py import MPI

In [2]: mem = MPI.Alloc_mem(1)

In [3]: mem
Out[3]: <read-write buffer ptr 0x8c561c8, size 1 at 0xf6c38040>

In [4]: MPI.Attach_buffer(mem)

In [5]: MPI.BSEND_OVERHEAD
Out[5]: 128

Any subsequent MPI_BSEND is likely to fail for lack of buffer space. Am I right?

2- MPI_BUFFER_ATTACH should raise an error if a previous buffer was
attached. OMPI currently seems to work like this, however in a second
call to attach i get an error code -104, which I think is internal and
should be remaped to public range [SUCCESS, LASTCODE). See below, the
error string is generated by MY code, because I asumed as a genral
rule that calling MPI_GET_ERROR_STRING is unsafe with an out of range
error code.

In [6]: MPI.Attach_buffer(mem)
---------------------------------------------------------------------------
mpi4py.MPI.Exception Traceback (most
recent call last)
# more output ....
Exception: unable to retrieve error string, ierr=-104 out of range
[MPI_SUCCESS=0, MPI_ERR_LASTCODE=54)

3 - MPI_BUFFER_DETACH should always success, even if there is no
buffer to detach. In the last case, it should return a null pointer,
and perhaps a zero size.

This way, inside a library routine we can safely call
MPI_BUFFER_DETACH, MPI_BUFFER_ATTACH/DETACH owned memory, and finally
test if original buffer (gotten in the initial call to detach) is
valid buy testing pointer or size.

Waiting for your comments...

Regards,

-- 
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