Question

What will happen if I send an empty vector in Boost MPI?

For example, if I sent using the following code:

vector<int> empty_vector;
vector<int> other_vector(1,1);

if (world.rank()==0)
    world.isend(1,10,empty_vector);
if (world.rank()==1)
    world.recv(0,10,other_vector);

Would this work? Would it just receive an empty vector and assign it to other_vector?

Thanks

Was it helpful?

Solution

I was hoping to get a quick response on this, but I didn't. So I went ahead and just tested it. You can send an empty vector as a message. After sending, rank 1 had an empty vector for other_vec and rank 1 had the original other_vec of size 1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top