MPI中的MPI_Probe和MPI_Get_count有什么区别 [英] what is the difference between MPI_Probe and MPI_Get_count in mpi
问题描述
我发现 MPI_Probe 用于查找消息大小,并使用 MPI_Get_count 查找消息长度.消息长度和消息大小有什么区别?他们两个不是一样的吗?此外,MPI_Send 或 MPI_Recv 中的计数参数表示什么?这是否意味着从进程 x 向进程 y 发送/接收相同消息的次数?
I've found that MPI_Probe is used to find the message size, and MPI_Get_count to find the message length. What's the difference between message length and message size? Aren't they both same? Moreover what's the count parameter in the MPI_Send or MPI_Recv signifies? Does it implies the no of times the same message will be sent/recieve from Process x to process y?
推荐答案
虽然 MPI_Probe
可用于查找消息的大小,但您必须使用 MPI_Get_count
来获取那个大小.MPI_Probe
返回一个 status
,它是一个数据结构,提供有关消息的信息,包括其来源、标签和大小.但是要获得该大小,您可以使用状态作为参数调用 MPI_Get_count
.
While MPI_Probe
may be used to find the size of a message you have to use MPI_Get_count
to get that size. MPI_Probe
returns a status
which is a data structure providing information about the message, including its source, tag and size. But to get that size you call MPI_Get_count
with the status as an argument.
我不确定您从哪里获得消息大小"和消息长度"这两个术语,或者您是如何得出它们不同的想法的.对我来说,消息大小只是 MPI 数据类型之一的实例数(通常称为 count
);所以一条消息可能携带 6 个 MPI_Integers,另一个可能携带 1024 MPI_Reals,依此类推.
I'm not sure where you've got the terms 'message size' and 'message length' from or how you have come to the idea that they are different. For me the message size is simply the number (usually called count
) of instances of one of the MPI datatypes; so one message might carry 6 MPI_Integers, another might carry 1024 MPI_Reals, and so forth.
当用作 MPI_Send
或 MPI_Recv
的参数时,count
是消息中数据类型的实例数——该数据类型在两个过程中都是 count
之后的下一个参数.
When used as an argument in MPI_Send
or MPI_Recv
the count
is the number of instances of a datatype in the message -- that datatype is in both procedures the next argument after the count
.
这篇关于MPI中的MPI_Probe和MPI_Get_count有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!