0

MPI_Get_count() 可以为计数返回负值吗?我的消息大小从不超过 1138 个整数。所以应该不是消息长度的问题。

    if(MPI_Probe(MPI_ANY_SOURCE,0,MPI_COMM_WORLD,&status) == MPI_SUCCESS)
    {
     printf("probe flag true\n");
     MPI_Get_count(&status,MPI_DOUBLE,&recv_size);
    }

我得到的 recv_size 值为负。

4

2 回答 2

1

如果消息大小不是提供给 MPI_Get_count 的数据类型大小的倍数,则 MPI_Get_count 将返回 MPI_UNDEFINED(很可能是负数)。因此,也许您将 5 个字节作为 MPI_BYTE 发送,但您询问 MPI_Get_count 您收到了多少 MPI_DOUBLES。

于 2012-06-14T22:08:43.480 回答
0

I just realised that it was a problem with the data I was sending. The values exceeded the sizeof double. Fixed it and the code worked. Thanks for the help and sorry for buggy code!

于 2012-06-15T08:08:32.750 回答