Thanks!

I've submitted ticket 484 about this:

    http://svn.open-mpi.org/trac/ompi/ticket/484


On 9/29/06 8:25 PM, "Lisandro Dalcin" <dalc...@intec.unl.edu.ar> wrote:

> I've just catched a problem with packing/unpacking using 'external32'
> in Linux. The problem seems to be word ordering, I believe you forgot
> to make the little-endian <-> big-endian conversion somewhere. Below,
> an interactive session with ipython (sorry, no time to write in C)
> showing the problem. Please, ignore me if this has been already
> reported.
> 
> In [1]: import numpy
> 
> In [2]: from mpi4py import MPI
> 
> In [3]: print numpy.dtype('i').itemsize, MPI.INT.extent
> 4 4
> 
> In [4]: print numpy.dtype('b').itemsize, MPI.BYTE.extent
> 1 1
> 
> In [5]:
> 
> In [5]: arr1 = numpy.array([256], dtype='i') # one int, for input
> 
> In [6]: print arr1
> [256]
> 
> In [7]: buf = numpy.array([0,0,0,0], dtype='b') # four bytes, auxiliar
> 
> In [8]: print buf
> [0 0 0 0]
> 
> In [9]: p = MPI.INT.Pack_external('external32', arr1, buf, 0)
> 
> In [10]: print buf, repr(buf.tostring())
> [0 1 0 0] '\x00\x01\x00\x00'
> 
> In [11]: arr2 = numpy.array([0], dtype='i') # one int, for output
> 
> In [12]: print arr2
> [0]
> 
> In [13]: p = MPI.INT.Unpack_external('external32', buf, 0, arr2)
> 
> In [14]: print arr2
> [65536]
> 
> In [15]: print arr2.byteswap()
> [256]
> 
> 
> -- 
> 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
> 
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/devel


-- 
Jeff Squyres
Server Virtualization Business Unit
Cisco Systems

Reply via email to