parallel.pool.DataQueue
Class that enables sending and listening for data between client and workers
Description
parallel.pool.DataQueue
enables sending data or messages from workers back to the client in a parallel pool while a computation is carried out. For example, you can get intermediate values and an indication of the progress of the computation.
To send data from a parallel pool worker back to the client, first construct aDataQueue
in the client. Pass thisDataQueue
into aparfor
-loop or other parallel language construct, such asspmd
. From the workers, callsend
to send data back to the client. At the client, register a function to be called each time data is received by usingafterEach
.
You can call
send
from the process that calls the constructor, if required.You can construct the queue on the workers and send it back to the client to enable communication in the reverse direction. However, you cannot send a queue from one worker to another. Use
spmd
,labSend
, orlabReceive
instead.Unlike all other handle objects,
DataQueue
instances do remain connected when they are sent to workers.
Construction
q
= parallel.pool.DataQueue
The constructor for aDataQueue
takes no arguments and returns an object that can be used to send or listen for messages (or data) from different workers. You call the constructor only in the process where you want to receive the data. In the usual workflow, the workers should not be calling the constructor, but should be handed an existingDataQueue
instance instead.
Properties
Methods
A parallel.pool.DataQueue object has the following methods.
afterEach | Define a function to call when new data is received on a DataQueue |
send | Send data from worker to client using a data queue |
Copy Semantics
Handle. To learn how handle classes affect copy operations, seeCopying Objects(MATLAB).
Examples
See Also
afterEach
|gcp
|labReceive
|labSend
|parallel.pool.PollableDataQueue
|parfor
|poll
|send
|spmd