Variable sized message in MPI

浪子不回头ぞ 提交于 2019-12-21 21:13:13

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4273253/variable-sized-message-in-mpi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!