[LUGSB] INTs as BYTEs in MPI

Lucas Carey lcarey at odd.bio.sunysb.edu
Mon May 16 12:18:04 EDT 2005


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





More information about the lugsb mailing list