A communication mismatch error was encountered: The other lab became idle during labReceive.

6 views (last 30 days)
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
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
fahimeh on 15 Oct 2014
In the code when ever I use labsend in one worker,use labReceive in another worker,like below:
if labindex==1
labReceive(2);
else
labeSend(1);
end
But I get the Error that explain. Is it correct or not?

Sign in to comment.

Categories

Find more on MATLAB 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!