$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [mpi] irecv / send problem
From: Nick Collier (nick.collier_at_[hidden])
Date: 2009-06-12 15:16:17
I running into an issue where an irecv followed by a send results in  
deadlock. A simple test case,
class Item {
private:
        friend class boost::serialization::access;
        template<class Archive>
        void serialize(Archive& ar, const unsigned int version) {
                ar & val;
        }
public:
        int val;
        Item() : val(1) {
        }
};
struct Receipt {
        boost::mpi::request request;
        std::vector<Item> items;
};
int main(int argc, char **argv) {
        mpi::environment env(argc, argv);
        mpi::communicator world;
        Receipt receipt;
        vector<Item> msg(100000);
        int other = world.rank() == 0 ? 1 : 0;
        cout << world.rank() << " irecv from " << other << endl;
        receipt.request = world.irecv(other, 0, receipt.items);
        cout << world.rank() << " sending to " << other << endl;
        world.send(other, 0, msg);
        receipt.request.wait();
        cout << "Done" << endl;
}
Run with mpirun -np 2, this never completes. It does complete with  
vector<Item> msg(10) however.
Nick