0

I am new in MPI I have some arrays generated by processors. Each processor generated one array with DIFFERENT length. How can I merging all of them IN ORDER in to one array only stored in processor 0.

Eg:

Processor 0: [1 1 1]
Processor 1: [2 2 2]
Processor 2: [3 3 3 3 3]
And my expected result is [1 1 1 2 2 2 3 3 3 3 3], not [1 1 1 3 3 3 3 3 2 2 2]

Is there anyone can help me solve this problem. Thank for reading :)

4

1 回答 1

0

如果提前知道每个等级贡献的大小,MPI_Gatherv 将在单个集合中完成这项工作。

如果事先不知道每个等级贡献的大小,则点对点操作(MPI_Send,带有 MPI_Probe 和 MPI_Recv)将是完成此任务的直接方法。根可以序列化 MPI_Recv 操作,并在操作进行时分配空间。

于 2013-09-22T02:46:37.600 回答