fast mpi right rotate large data

184 Views Asked by At

I want to move data to right in a circular way once using MPI. That is, if you have 4 nodes, 1->2, 2->3, 3->4, 4->1. I am using boost mpi and have the following code to do it.

mat new_W(this->W.n_rows,this->W.n_cols);
int p_send = MPI_RANK + 1 >= MPI_SIZE ? 0 : MPI_RANK + 1;
int p_recv = MPI_RANK - 1 < 0 ? MPI_SIZE - 1 : MPI_RANK - 1;
vector<boost::mpi::request> reqs;
reqs.push_back(this->world.isend(p_send, MAT_TAG, this->W));
reqs.push_back(this->world.irecv(p_recv, MAT_TAG, new_W));    
boost::mpi::wait_all(ALL(reqs));

On the above code I have the following observations.

  1. While sending larger data sizes, MPI_ALL_GATHER over the all the nodes is faster than this right rotate. That is every one exchanging their data with everyone is faster than just sending to its neighbor. My MPI_ALL_GATHER routine is as follows.

    vector<mat> all_x;  
    boost::mpi::all_gather (this->world,X,all_x);
    
  2. How to make the above right rotate faster for larger data packets.

0

There are 0 best solutions below