Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:22:57+00:00 2026-06-04T19:22:57+00:00

Is it enough to check only one request object from two matching non-blocking send

  • 0

Is it enough to check only one request object from two matching non-blocking send and recv operations.

This would be great as this would reduce the effort to handle the request objects in my program.

Here a small example with boost mpi:

#include <boost/mpi.hpp>

int main(int argc, char* argv[]) {
    // initialize mpi

    mpi::environment env(argc, argv);
    boost::mpi::communicator world;
    boost::mpi::request req0, req1;
    double blub;
    if(world.rank()==1)
       req1 = world.irecv(0, 23, blub);
    if(world.rank()==0)
       req0 = world.isend(0, 23, blub);

    //now I want to synchronize the processors is this enough?
    req0.wait();
    //or do I also need this line
    req1.wait();

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:22:58+00:00Added an answer on June 4, 2026 at 7:22 pm

    Rank 1 doesn’t have a valid req0, and rank 0 doesn’t have a valid req1; they are requests which are only valid on the tasks that actually performed the nonblocking operation (and returned a handle to a request).

    So no, neither rank here needs to (or even could) call wait on both requests; each calls a wait on the request that it has, eg

    if(world.rank()==0)
        req0.wait();
    if(world.rank()==1)
        req1.wait();
    

    or, better (I assume that the isend for rank 0 should go to rank 1, not 0):

    boost::mpi::request req;
    ...
    if(world.rank()==1)
       req = world.irecv(0, 23, blub);
    if(world.rank()==0)
       req = world.isend(1, 23, blub);
    
    if (world.rank() == 0 || world.rank() == 1)
       req.wait();
    

    Note that when you do need to wait for the multiple operations corresponding to multiple requests, you can have a list of the requests and call wait_all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright there's two ways this can go. One is from the presentation side, and
Trying to check if an object has a class. Seems simple enough, but I
I couldn't find enough resource about this subject and i need to learn how
Does doing good enough software take anything from you being a programmer? Here are
I have two tables tabData and tabDataDetail. I want all idData(PK) from Parent-Table(tabData) that
Oddly enough, most of this works as it has been written, however I'm not
my company is small with only one full time tester, and mostly we're doing
Ok, so this seems bad (and it probably is, but i have enough doubts
I'm trying to use the mutex method for only allowing one instance of my
(Probably just knowledge of the Unix library is enough to answer this, so please

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.