Hi, I would like my MPI processes to exchange some structural data. That data is represented by plain structures containing basic datatypes. I would like to use MPI derived datatypes, because of its portability and good performance.
I would like to be able to send/receive any of my structures in the same part of code. In the low-level network programming it is usually done by having each struct of this pattern: struct S1 { int structType; ... } And then you first read structType and know what bytes to expect next. Is there a good way to do it using MPI derived datatypes? I was thinking of having separate MPI_Request for each of my structures and calling multiple MPI_Irecv + MPI_Waitany. But then, how to do this for MPI_Bcast? My second question is about having arbitrary size structures, i.e. the ones having 'char buf[0]' as the last field, where you allocate memory of size 'sizeof(S) + bufLen'. Is there a way to convert such a struct into MPI derived datatype? Thanks for any help, Regards, Grzegorz Maj