Variable to track parfor loop progress
3 次查看(过去 30 天)
显示 更早的评论
I am using a paralled program and i would like to keep track of the progress of the loop, each iteration takes more or less the same time to execute. I came up with the following solution.
i=0;
parfor j=0:max
sprintf('%f',i);
some_calculation(j);
i=i+1;
end
I know I cannot use a variable in this way, but I believe the variable "i" could be used without any trouble in this way. Any work around?
Thanks, Andreu
0 个评论
回答(2 个)
Edric Ellis
2018-12-19
@Matt J posted the simplest option which is to have the parfor loop display data. If you need more sophistication, you can use DataQueue to perform arbitrary computations at the client as the loop progresses, such as displaying a waitbar.
0 个评论
Matt J
2018-12-18
What I do is display the loop counter, like in the following
parfor j=0:Jmax
some_calculation(j);
j,
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!