- size = 0;
- std::vector<MPI_Request> myreqqs;
- auto iter = reqqs->begin();
- int proc_id = comm_->group()->actor(rank)->get_pid();
- while (iter != reqqs->end()){
- // Let's see if we're either the destination or the sender of this request
- // because we only wait for requests that we are responsible for.
- // Also use the process id here since the request itself returns from src()
- // and dst() the process id, NOT the rank (which only exists in the context of a communicator).
- if (((*iter) != MPI_REQUEST_NULL) && (((*iter)->src() == proc_id) || ((*iter)->dst() == proc_id))) {
- myreqqs.push_back(*iter);
- iter = reqqs->erase(iter);
- size++;
- } else {
- ++iter;
- }
- }
- if(size >0){
- MPI_Request* treqs = &myreqqs[0];
- Request::waitall(size, treqs, MPI_STATUSES_IGNORE);
- myreqqs.clear();
- }
+ MPI_Request* treqs = myreqqs.data();
+ Request::waitall(size, treqs, MPI_STATUSES_IGNORE);
+ myreqqs.clear();