简体   繁体   中英

MPI_Allgather to the same array but at different indexes

Consider I have the following processes which have their own copy of an array of some size (lets go with length 4) and have each calculated some values and stored it in an array according to a compressed row/col storage format.

A = [. . . .]

P0: A[ 1. 3.]

P1: A[. 2. 4]

  1. P1 sends A to P0
  2. P0 combine P1.A with P0.A => [1 2 3 4]

Is there a way for me to merge these arrays such as using some type of AllGather? There will never be any overlapping values to merge.

My current approach is to use do MPI_Send(indexes_used, to P0) for each process, then send the A array with another MPI_Send.

If the empty values on each process are set to zero you can just sum the arrays up with MPI_Allreduce .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM