Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Lisandro Dalcin (dalcinl_at_[hidden])
Date: 2007-07-24 10:20:11

On 7/23/07, Jeff Squyres <jsquyres_at_[hidden]> wrote:
> Does anyone have any opinions on this? If not, I'll go implement
> option #1.

Sorry, Jeff... just reading this. I think your option #1 is the
better. However, I want to warn you about to issues:

* In my Linux FC6 box, malloc(0) return different pointers for each
call. In fact, I believe this is a requeriment for malloc, in the case
of MPI_Alloc_mem, this could be relaxed, but it could cause problems
(supose some code building a hash table using pointers as keys, or
even a stl::map<void*, something>). Just a warn.

* malloc(0) return an aligned pointer, here I really think
MPI_Alloc_mem should return a pointer with the same aligment a
malloc(1) would return. So I am not sure your global char[1] is OK.

As reference, I can comment the approach used in Python memory
allocator to assure portability across platforms. They always alloc at
least 1 byte. This is not so important in an environment like Python,
but perhaps this approach in wrong for an MPI implementation.


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