parTicToc

版本 1.0.0.1 (135.0 KB) 作者: Sarah Wait Zaranek
This is a utility for timing PARFOR loops.
2.0K 次下载
更新时间 2016/9/1

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

This utility is a class for timing PARFOR loops. It can be used to observe the various overheads that may exist in parallel for loops and the utilization of each worker. Various examples of using this utility can be found in Example_Script.m.

This class should be used in the following way:

p = Par(n); (1)
parfor id = 1:n
Par.tic; (2)

<usual computations>

p(id) = Par.toc; (3)
end
stop(p); (4)

plot(p); (5)

1. Construct a Par object, with the number of iterations as the input. This constructs the object.
2. Call Par.tic just inside the PARFOR loop. This records the start time of the iteration.
3. Call Par.toc just before the end of the PARFOR loop. Store the
output to the appropriate index of the Par object. This is necessary for PARFOR to recognize that the variable is sliced.
4. Stop the measurement. This records the final end time.
5. Visualize.

There may be some overhead in adding the Par construct. Because of this, the numbers you get may not accurately portray the true timing, especially for short computations.

引用格式

Sarah Wait Zaranek (2024). parTicToc (https://www.mathworks.com/matlabcentral/fileexchange/27472-partictoc), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2010a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Parallel for-Loops (parfor) 的更多信息

Community Treasure Hunt

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

Start Hunting!

html/

版本 已发布 发行说明
1.0.0.1

Updated license

1.0.0.0