parfor Vs muliple matlab session

7 Ansichten (letzte 30 Tage)
d
d am 28 Feb. 2019
Beantwortet: Edric Ellis am 1 Mär. 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.

Akzeptierte Antwort

Edric Ellis
Edric Ellis am 1 Mär. 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)

Weitere Antworten (0)

Kategorien

Mehr zu Parallel for-Loops (parfor) finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by