parfor Vs muliple matlab session
4 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
Edric Ellis
2019 年 3 月 1 日
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)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Parallel for-Loops (parfor) についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!