The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: labReceive goes to sleep
Replies: 2   Last Post: Dec 14, 2012 11:30 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Edric Ellis

Posts: 721
Registered: 12/7/04
Re: labReceive goes to sleep
Posted: Dec 14, 2012 4:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"jaesung Park" <> writes:

> I am writing a parallel code of a master-slave model for data
> processing. The master worker, 1, is listening to any request from
> slaves, 2-8, and distribute the work load and determine the exit
> condition. The master worker uses [data, source, tag] = labReceive to
> wait until any slave finishes and report. After two communications
> between master and slaves, the master goes to sleep and doesn't wake
> up until all the slaves send report. This makes the earlier finished
> workers idle until all others are done. I am using mpiSettings to
> check the deadlock but it is not the synchronization problem but the
> labReceive somehow does not respond promptly. I suspect if there is
> any buffer to fill for the communication but not clear in any Matlab
> documentations. The code looks like:
> spmd
> if labindex == 1 %Master
> while (NOT Exit condition)
> [data, source, tag] = labReceive;
> % Process the data
> labSend(processed_data, source);
> % Update Exit condition
> end
> else %Slave
> while (NOT Exit condition)
> % Computation
> processed_data = labSendReceive(1,1,computed_data, 1);
> % Update Exit condition
> % Update computation variable
> end
> end

It's difficult to know exactly what the problem is here. I'll just point
out a few things that might give you some more information:

1. labSendReceive is not really intended to be used in conjunction with
separate labSend/labReceive calls as you are doing here - but I don't
think this is the problem (and as you've discovered, it should work). In
your case, the 'slaves' could quite easily use separate labSend and
labReceive calls.

2. The buffering in the labSend/Receive calls is done entirely by the
MPI implementation (MPICH2), and in practice what you'll find is that a
call to 'labSend' can complete before the corresponding 'labReceive' has
been posted only if the message is less than around 128kB.

3. Deadlock detection only operates on separate labSend/labReceive

4. Is there any other communication going on? How are you sure that all
labs 'exit condition' is in sync?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.