Starting a parfor loop

1 回表示 (過去 30 日間)
george pepper
george pepper 2020 年 4 月 30 日
コメント済み: george pepper 2020 年 5 月 5 日
Hello,
I am completely new to parallel computing with MATLAB. I have a basic for-loop in which I evaluate a complicated function for many different values. It would be so much faster if I just replace the for loop with a parfor loop and use several workers. However, I'm struggling with starting the parallel computing process. Can someone tell me how to code it (I have downloaded the package )? Many thanks!
George

採用された回答

Edric Ellis
Edric Ellis 2020 年 5 月 1 日
It might be useful to read this introduction to Parallel Computing Toolbox. In essense, you should simply be able to write a parfor loop, and with default settings, Parallel Computing Toolbox will automatically start a "parallel pool" of workers to work on the body of the loop in parallel. You don't need to start the workers explicitly, but you can do that if you wish - the following command will (with default settings) launch as many workers as you have (real) CPU cores on your local machine:
parpool();
  1 件のコメント
george pepper
george pepper 2020 年 5 月 5 日
Thanks.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel Computing Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by