Variable sized message in MPI

2019-04-11 11:54发布

Is there a library call that would allow for sending/receiving of variable sized messages using MPI?

A work around would be to send the data size in the first message and follow it with the actual payload, but I was wondering if there was a convention for combining these two separate messages.

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-04-11 12:16

The count provided to MPI_Recv is only an upper bound. MPI_Get_count can be used to find the exact number of items received.

Kind of like sockets I guess.

查看更多
太酷不给撩
3楼-- · 2019-04-11 12:27

You could also use MPI_Probe or MPI_Iprobe instead of posting a receive with MPI_Recv or MPI_Irecv. Probe/Iprobe can have performance disadvantages if used incorrectly, but they are one common approach to dealing with variable-sized messages. Also, be careful in a multithreaded environment because Probe/Iprobe are not safe in some multithreaded contexts. See Hoefler et al. for a thorough discussion of these problems and a sketch of the fix (Mprobe) likely to be included in MPI-3.

查看更多
登录 后发表回答