A communication mismatch error was encountered: The other lab became idle during labReceive.
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Edric Ellis
2014-10-14
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!