parfor Vs muliple matlab session

13 vues (au cours des 30 derniers jours)
d
d le 28 Fév 2019
I need to run my code multiple times with different parameters. What I've done so far is to open several matlab windows (until my CPU was full) and on each one I run the code with different parameters. I'm wondering if this is a good solution or whether parfor mey do a better job, especially with regard to the time consuming.
Each execution can take several hours and even one or two days.

Réponse acceptée

Edric Ellis
Edric Ellis le 1 Mar 2019
parfor ought to be considerably more convenient than manually opening multiple MATLAB windows and ensuring they're all working on different things. It might also turn out to complete sooner, as the parfor infrastructure attempts to load-balance across the workers.
One additional thing to be aware of: if you run multiple desktop MATLAB instances, by default each will run in multi-threaded mode, whereas the default for Parallel Computing Toolbox workers is to use only a single computational thread. Whether or not this has any influence on your program is highly dependent on how well MATLAB can intrinsically multi-thread it. (However, if you're seeing speed-up by running multiple desktop MATLAB instance, that pretty much implies that implicit multi-threading is of limited benefit to your program).
If you want to work out whether MATLAB's implicit multi-threading is giving your program any performance benefits, you can try disabling it (temporarily) by running
maxNumCompThreads(1)

Plus de réponses (0)

Catégories

En savoir plus sur Parallel for-Loops (parfor) dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by