|
Boost Users : |
Subject: [Boost-users] synchronization problem
From: alev mutlu (koor230_at_[hidden])
Date: 2010-03-28 11:04:25
Hi all,
For the following code I want to stop early completing processes and wait
for the others at the point with (world.barrier)(); statement.
But the problem is stop- and stop+ do interleave. Am I doing something wrong
with the synchronization, or there is something wrong with my code?
if (world.rank() == MASTER){
m_mySize = n / world.size() + n % world.size();
w_mySize = n / world.size();
for(int p = 1; p < world.size(); p++){
world.send(p, 1, w_mySize);
world.send(p, 2, n);
}
relMyValues = new possibleClause[w_mySize];
scatter(world, pC, relMyValues, w_mySize, 0);
}
else{
world.recv(0, 1, w_mySize);
relMyValues = new possibleClause[w_mySize];
scatter(world, pC, relMyValues, w_mySize, 0);
}
for(i = 0; i < w_mySize; i++){
//do something
}
cout << world.rank() << " stop - " << world.rank() << endl;
(world.barrier)();
cout << world.rank() << " stop + " << world.rank() << endl;
if (world.rank() == MASTER){
relAllValues = new possibleClause[n - n % world.size()];
gather(world, relMyValues, w_mySize, relAllValues, 0);
}
else{
world.recv(0, 2, n);
gather(world, relMyValues, w_mySize, relAllValues, 0);
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net