A communication mismatch error was encountered: The other lab became idle during labReceive.
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.
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.
1 Comment
fahimeh
on 15 Oct 2014
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!