Sharing Information Between Client and Workers with the Parallel Computing Toolbox
Mostrar comentarios más antiguos
Hello, I have started working with the Parallel Computing Toolbox and have three questions:
1. The first time (in a Matlab session) I try to create a job, Matlab hangs for a very long time (maybe 4 minutes or so). The subsequent createJob executions are much faster. This is also the case when trying to "validate" the cluster profile. Matlab gets stuck on the createJob task. Why is that?
2. Is is possible to share objects between the Matlab client and workers? I would like the worker to update an object's properties that the client would then be able to read. An example would be to update the status of an object as the worker executes a function (eg: phase one complete, phase 2 complete...). I have tried using the jobData property of the MATLAB job to store the object, but its properties do not get updated...
3. This is similar to two in that it is about sharing information between the client and the worker during execution: Is it possible to define custom callbacks during a worker's execution. My worker could thus send back partial data as soon as it finished computing it by executing this callback. The callback would be caught by the client and displayed in a plot (for example).
Thanks, Jeremy
Respuesta aceptada
Más respuestas (1)
Edric Ellis
el 1 de Abr. de 2015
0 votos
If you want to perform interactive parallel computing, you might be better off investigating the capabilities of the parallel pool. This connects up several MATLAB workers to your client MATLAB, and allows them to be used interactively for parfor loops, smpd blocks and parfeval calls. With parfeval, you might be able to do something like you're after - it lets you invoke functions on the workers sending data and getting back output arguments - without the overhead of launching a separate job (the workers are already running as part of the parallel pool).
There's an entry on Loren's blog here that shows how you can use parfeval to achieve interactive parallelism.
2 comentarios
Jeremy
el 1 de Abr. de 2015
Edric Ellis
el 2 de Abr. de 2015
For this sort of application, you'll need to set up the objects within the function that you call within parfeval. If you need to set up an object and then use it multiple times, you can use the Worker Object Wrapper together with parfeval.
Categorías
Más información sobre Parallel for-Loops (parfor) en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!