A communication mismatch error was encountered: The other lab became idle during labReceive.
6 views (last 30 days)
Show older comments
I use spmd to have two parallel tasks and I use labsend and labreceive methods to transfer data between these tasks,but I get the following Error: A communication mismatch error was encountered: The other lab became idle during labReceive. what should I do to solve this error? Is there a better way to have parallel tasks? please help me.
0 Comments
Answers (1)
Edric Ellis
on 14 Oct 2014
This error essentially tells you that the other worker (or "lab") got to the end of the spmd block before it sent any data. A simple example might be the following:
spmd
if labindex == 1
labReceive(2);
end
end
In this case, lab 1 is waiting for a message to be sent by lab 2 - but lab 2 never sends anything before getting to the end of the spmd block.
In general, to avoid errors like this, you must ensure that all your labSend and labReceive calls are matched up under all circumstances.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!