Hello All,

I need to send a struct- datatype over MPI. Currently, I send the strcture as a series of MPI_BYTEs and on the other end, I dereference it as though it were a struct- type.

Something like this:

MPI_Ssend((void*)&MasterSlavePayload, sizeof(MasterSlavePayload), MPI_BYTE, destNode,MASTERSLAVECONTROLMESSAGE,MPI_COMM_WORLD);

where MasterSlavePayload is a structure variable.


This currently seems to work, where we have a homogenous environment: same hardware configuration, and same operating system.

The question is: Is this approach portable? Safe? And whether this will work on a system of nodes with mixed processor types?

I read from MPI tutorials

"...Primitive data types are contiguous. Derived data types allow you to specify non-contiguous data in a convenient manner and to treat it as though it was contiguous. "

So, since I am using a primitive data type, does it mean that the packing of elements is maintained across the MPI_Send/MPI_Recv process? If so, it would mean that the approach that I use should work.

Any ideas?

Thanks a lot,

best

Devendra