Fast mpi right turn big data

I want to move data to the right in a circular fashion 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 for that.

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));

      

The above code has the following observations.

  • When sending large data sizes MPI_ALL_GATHER across all nodes is faster than it turns. That is, everyone who exchanges their data with everyone is faster than just sending to their neighbor. My procedure MPI_ALL_GATHER is as follows.

    vector<mat> all_x;  
    boost::mpi::all_gather (this->world,X,all_x);
    
          

  • How to make the above rotate right faster for large data packets.

+3


source to share





All Articles