Parallel computing (parfor) or various GUI?

5 views (last 30 days)
Hi Everybody,
I can hav acces to more than one Matlab license so that I can run various GUI at the same time in my computer. The thing is I want to use all the power of my computer to speed up my simulations which are independent, say function f1,f2 and f3.
What would be the fastest way to launch all three simulations at the same time and get the best speed?
1st Way
parfor r=1:3
function1
function2
function3
end
2nd Way
Opening three different gui and launching in each one a different function.
I have donde some tests with "easy" functions and it seems that opening various gui slows the processs. But since using the parallelization toolbox would require changes in the programming (probably) I would like to ask you if you have any experience on this subject that you could share.
Thank you very much!

Accepted Answer

Edric Ellis
Edric Ellis on 8 Apr 2013
Parallel Computing Toolbox workers aren't able to display graphics, so you cannot use them to display GUIs directly from the workers. However, you can use the workers to perform computations. How best to make things work depends on how long your different simulations take. Using PARFOR may well not turn out to be the best option, because the loop only completes when the entire body is complete. Even if one of your simulations takes less time than the others, you wont be able to see the results until all are complete.

More Answers (1)

esbolico
esbolico on 8 Apr 2013
Hi Edric!
and thank you for your answer. My simulations don't use graphics they just write some results into a .mat file. The thing is that I use an i7 intel and during the simulations it does not seem to use all the cpus. If I open 1 gui and I launch there a simulation it takes around 2 minutes to finish and if I open another gui and launch another simulation (which should take the same time) it takes 4 minutes to end both simulations so I think that I am not taking full advantage of the power of the computer (my RAM memory is more than enough for the task as it is mainly cpu-intensive). Any ideas?
Thank you very much!
  2 Comments
Edric Ellis
Edric Ellis on 8 Apr 2013
Hm, if I've understood correctly, running two simulations at the same time causes both of them to slow down. This implies that the simulations are competing for resources on your computer - this could be CPU time, or it could be memory bandwidth (or something else). Have you checked using task manager to see how much CPU each simulation uses? Have you used the MATLAB profiler to see where time is being spent?
esbolico
esbolico on 24 Apr 2013
Hi Edric,
the problem is solved. Somehow matlab was not opening all the workers and I could not use all the cpus. However I do not know why opening different GUIs slows the process so much. Each process is only consuming a little bit of cpu (around 10-15%). Any idea on that?

Sign in to comment.

Categories

Find more on Parallel Computing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!