[LUGSB] INTs as BYTEs in MPI
Nick Horvath
nhorvath at gmail.com
Mon May 16 13:05:57 EDT 2005
Well first of all your system does not have sizeof(int) ==
sizeof(byte). Ints are 4 bytes long on i386 computers and 8 bytes long
on 64-bit systems. If it is working on your system now then you will
probably have no trouble, however you are wasting lots of memory this
way. You may actually lose performance by having to send more data. I
know the MPI calls are slow, but if these are decently large arrays it
might not be worth it.
-Nick
On 5/16/05, Lucas Carey <lcarey at odd.bio.sunysb.edu> wrote:
> Hey you real computer science people,
> I'm writing an MPI program, and I want to condense two sends down into one. For those of you who don't know, MPI allows interprocess communication across computers. One of these sends is an array of INTs, the other an array of BYTEs. If I throw the bytes into the int array, can I reinterpret them as bytes later on, as I know the offset from which they will start in the int array.
> currently:
> *int_array = [0,1,2,3,4]
> *byte_array = [b1,b2,b3,b4]
>
> want:
> *int_array = [0,1,2,3,4,b1,b2,b3,b4]
> *byte_array = &int_array[5]
>
> or something like that. I know I can send the data as a struct, but I prefer to avoid having to pack the data up to send it.
> Are there any platforms where sizeof(int)!=sizeof(byte) where this might break?
> -Lucas
>
> _______________________________________________
> lugsb mailing list
> lugsb at mail.fsl.cs.sunysb.edu
> http://www.fsl.cs.sunysb.edu/mailman/listinfo/lugsb
>
More information about the lugsb
mailing list