Parallel Computing: Execute GUI and programm parallel
Mostrar comentarios más antiguos
Hello, I would like to start a GUI (GUIDE) and parallel execute another job. Is there any solution how to realise that problem. When I start the GUI for example in a parfor no User-Interface pops up.
Respuestas (1)
Walter Roberson
el 19 de En. de 2017
1 voto
It is not possible to do graphics from inside a worker.
There is a demonstration around, written by one of the Mathworks people, that deals with collecting results from multiple workers as they come in, and graphing the results. Unfortunately I do not seem to find that at the moment. It might have used parfeval.
The point is that with some care you can transfer data back to a controlling routine that plots data that has been generated by the workers; however, it does not allow multiple workers to draw graphics.
6 comentarios
Ronron
el 19 de En. de 2017
Walter Roberson
el 19 de En. de 2017
Typically, a GUIDE GUI will not block -- you will have access to the command line. You can start other functions, including other GUIs. However, people who write GUIs sometimes make assumptions that they are the only GUI running, so sometimes GUIs can interfere with each other.
If you have access to the command line while you are running a GUI, then yes you can run a function that uses parfor.
One thing to keep in mind is that GUI callbacks can only occur under one of these circumstances:
- MATLAB is waiting for interaction at the command line (including if the program used keyboard())
- figure() is called
- pause() or drawnow() are called
- uiwait() or waitfor() are called
If you are running code that uses parfor() or spmd(), then the thread that is controlling the workers does not execute any of those functions periodically, and any execution of those on the workers does not affect the main display. You might end up waiting a fair while for a callback to be processed. You just might be able to reduce that by having a timer callback that does a drawnow() -- I have never experimented with that.
Because of this, if you want to run parallel routines while leaving a GUI active, you are better off using parfeval() or batch(), as those leave a thread in control that can periodically call drawnow() while it waits for the workers to finish.
Walter Roberson
el 15 de Feb. de 2017
Use parfevalOnAll to load the .Net class on all of the workers
Ronron
el 15 de Feb. de 2017
Walter Roberson
el 15 de Feb. de 2017
I am not familiar with how NET and import works, sorry. Perhaps you need to attach files to the pool ? https://www.mathworks.com/help/distcomp/addattachedfiles.html
Categorías
Más información sobre Parallel Computing Fundamentals en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!