Opened 9 years ago

#9502 new Bugs

Unexpected behaviour of boost::mpi::request::test()

Reported by: ettersi@… Owned by: Matthias Troyer
Milestone: To Be Determined Component: mpi
Version: Boost 1.55.0 Severity: Problem
Keywords: request test Cc:

Description

The following code snippet shows that boost::mpi::request::test() behaves differently depending on whether we send a message of built-in type or a message of custom type:

struct custom_type {
    template<class Archive>
    void serialize(Archive& ar, const unsigned int version) {}
};

[...]

int i;
auto req = comm.irecv(0,0,i);
req.wait();
std::cout << "Did we receive the built in type message: " << bool(req.test()) << std::endl;

custom_type c;
auto req = comm.irecv(0,0,c);
req.wait();
std::cout << "Did we receive the custom type message: " << bool(req.test()) << std::endl;

Output:

Did we receive the built in type message: 1
Did we receive the custom type message: 0

Similar behaviour is observed if you just repeatedly call req.test(): For the built-in type, the returned boost::optional switches from empty to non-empty once and then stays non-empty, whereas for the custom type it switches from empty to non-empty and in the next call goes back to empty again.

For our application, it would be desirable if the custom type behaviour would be the same as the built-in type behaviour. If this is not possible or not advisable, then at least the documentation of boost::mpi::request should mention this difference in behaviour.

Attachments (1)

request.cpp (818 bytes ) - added by ettersi@… 9 years ago.
Complete program that reproduces the error

Download all attachments as: .zip

Change History (1)

by ettersi@…, 9 years ago

Attachment: request.cpp added

Complete program that reproduces the error

Note: See TracTickets for help on using tickets.