parallel.pool.PollableDataQueue
Send and poll data between client and workers
Description
A PollableDataQueue
object enables synchronous sending and
polling for data or messages between workers and client in a parallel pool while a computation
is carried out. For example, you can send intermediate values to the client and use the values
in another computation.
To send data from a parallel pool worker back to the client, first create a
PollableDataQueue
object at the client. Pass this
PollableDataQueue
object into a parfor
-loop or other
parallel language construct, such as parfeval
. From the workers, call
send
to send data back to the client. At the client, use
poll
to retrieve the result of a message or data sent from a
worker.
You can call
send
from the worker or client that created thePollableDataQueue
, if required.PollableDataQueue
sends the data only to the client or worker that created thePollableDataQueue
.You can create the queue on the workers and send it back to the client to enable communication in the reverse direction.
Before R2023b: You cannot send a queue from one worker to another. To transfer data between workers, use
spmd
,spmdSend
, orspmdReceive
instead.Unlike all other handle objects,
PollableDataQueue
andDataQueue
instances do remain connected when they are sent to workers.
Creation
Description
creates an object that you can use to send and
poll for messages (or data) between the client and workers. Create the
p
=
parallel.pool.PollableDataQueuePollableDataQueue
on the worker or client where you want to receive the
data.
Properties
Object Functions
Examples
Tips
You can only manually retrieve data or messages sent using a
PollableDataQueue
object. To automatically process data after it is received on the client, use aparallel.pool.DataQueue
object to send the data instead.
Extended Capabilities
Version History
Introduced in R2017a
See Also
gcp
| poll
| parfor
| send
| parallel.pool.DataQueue
| spmdReceive
| spmdSend
| parfeval
| parfevalOnAll