gpt4 book ai didi

c++ - MPI_AllToAllV 导致 MPI_ERR_TRUNCATE

转载 作者:行者123 更新时间:2023-11-30 04:06:36 25 4
gpt4 key购买 nike

我有以下 MPI_AllToAllv 调用。所有的变量都是 vector

MPI_Alltoallv(
&elements[0],
&send_counts[0],
&send_displacements[0],
MPI_INT,
&receiving_vector[0],
&receiving_counts[0],
&receiving_displacements[0],
MPI_INT,
MPI_COMM_WORLD
);

这里是 vector 的内容:

Elements : [6, 5, 4, ]
@ 0
Elements : [3, 2, 1, ]
@ 1
send_counts : [3, 0, ]
@ 1
send_displacements : [0, 3, ]
@ 1
receiving_vector : [0, 0, 0, ]
@ 0
elements : [6, 5, 4, ]
@ 0
send_counts : [0, 3, ]
@ 0
send_displacements : [0, 0, ]
@ 0
receiving_vector : [0, 0, 0, ]
@ 1
receiving_counts : [0, 3, ]
@ 1
receiving_displacements : [0, 0, ]
@ 1
[lawn-143-215-98-238:1182] *** An error occurred in MPI_Alltoallv
[lawn-143-215-98-238:1182] *** reported by process [2332229633,0]
[lawn-143-215-98-238:1182] *** on communicator MPI_COMM_WORLD
[lawn-143-215-98-238:1182] *** MPI_ERR_TRUNCATE: message truncated
[lawn-143-215-98-238:1182] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
[lawn-143-215-98-238:1182] *** and potentially your MPI job)
receiving_counts : [3, 0, ]
@ 0
receiving_displacements : [0, 0, ]
@ 0

我不明白为什么会出现此错误。任何帮助将不胜感激。

我用谷歌搜索了这个错误,它可能是我的接收 vector 的大小,但我已经尝试了很多大小,但没有得到任何结果。

最佳答案

发送的数据量和接收的数据量不匹配。由于您只有两个等级,因此很容易画出谁发送多少以及发送给谁的表格。表格的每一行都是相应排名的send_counts[]的内容:

      receiver
s | 0 | 1 |
e ---+---+---+
n 0 | 0 | 3 | (send_counts[] @ 0)
d ---+---+---+
e 1 | 3 | 0 | (send_counts[] @ 1)
r ---+---+---+

为了匹配发送的数据量,每个等级的接收计数应等于上表中对应于该等级的列 vector :

  • receiving_counts[] @ 0 应该是 { 0, 3 } 而你有 [3, 0, ];

  • receiving_counts[] @ 1 应该是 { 3, 0 } 而你有 [0, 3, ]

因此出现截断错误。

关于c++ - MPI_AllToAllV 导致 MPI_ERR_TRUNCATE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22830135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com