How to evaluate the computation time of some codes in parallel properly?

3 ビュー (過去 30 日間)
Slivery
Slivery 2022 年 8 月 2 日
コメント済み: Slivery 2022 年 8 月 4 日
I need to evaluate the computation time of an algorithm in multiple runs (e.g., 21 runs). To reduce the time, I use parfor to conduct 21 runs in parallel. However, I found that the compuation time of algorithms in parfor is very unstable, especially when the computation time of the algorithm is short. I use tic and toc in the parfor to record computation time.
Is there any other method in matlab to evaluate the computation time in parallel more properly ? Your help is really appreciated!
  2 件のコメント
Slivery
Slivery 2022 年 8 月 3 日
Thanks a lot for your help! I will try these methods.

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

採用された回答

Jeffrey Clark
Jeffrey Clark 2022 年 8 月 3 日
@Slivery, when using the cputime difference method don't forget to divide by 21 (the number of executions being averaged). Depending on how short each computation is you may still have a lot of MATLAB and threading overhead time included in your timing. In that case add a wrapper for your function to simply loop N times and then include N in your division.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by