<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166139</link>
    <title>MATLAB Central Newsreader - waitbar for parfor loops</title>
    <description>Feed for thread: waitbar for parfor loops</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 21 Mar 2008 16:02:01 -0400</pubDate>
      <title>waitbar for parfor loops</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166139#422160</link>
      <author>William Dampier</author>
      <description>I was wondering if anyone has found a way to do progressbars&lt;br&gt;
for the new parfor loops in R2007b and 2008a.&lt;br&gt;
&lt;br&gt;
For normal for-loops the simple waitbar command works well.&lt;br&gt;
waitbar(0)&lt;br&gt;
for i=1:N&lt;br&gt;
waitbar(i/N)&lt;br&gt;
...do something&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
however it doesn't work with the parfor loops, since things&lt;br&gt;
aren't done in order.&lt;br&gt;
&lt;br&gt;
Has anybody made a function or found a work-around?&lt;br&gt;
&lt;br&gt;
Thanks&lt;br&gt;
Will</description>
    </item>
    <item>
      <pubDate>Fri, 21 Mar 2008 18:07:02 -0400</pubDate>
      <title>Re: waitbar for parfor loops</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166139#422179</link>
      <author>Narfi </author>
      <description>William,&lt;br&gt;
&lt;br&gt;
Currently, there is unfortunately no way of receiving&lt;br&gt;
notification in the MATLAB client when an iteration is&lt;br&gt;
completed on a worker.&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
&lt;br&gt;
Narfi&lt;br&gt;
&quot;William Dampier&quot; &amp;lt;walldo2@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fs0m5p$nkd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I was wondering if anyone has found a way to do progressbars&lt;br&gt;
&amp;gt; for the new parfor loops in R2007b and 2008a.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; For normal for-loops the simple waitbar command works well.&lt;br&gt;
&amp;gt; waitbar(0)&lt;br&gt;
&amp;gt; for i=1:N&lt;br&gt;
&amp;gt; waitbar(i/N)&lt;br&gt;
&amp;gt; ...do something&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; however it doesn't work with the parfor loops, since things&lt;br&gt;
&amp;gt; aren't done in order.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Has anybody made a function or found a work-around?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks&lt;br&gt;
&amp;gt; Will</description>
    </item>
    <item>
      <pubDate>Fri, 21 Mar 2008 19:12:01 -0400</pubDate>
      <title>Re: waitbar for parfor loops</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166139#422191</link>
      <author>William Dampier</author>
      <description>You don't necessarily need something that communicates when&lt;br&gt;
an iteration is done ... you just need something that can&lt;br&gt;
tell a waitbar to update.&lt;br&gt;
&lt;br&gt;
I've tried something along these lines so far, maybe it will&lt;br&gt;
inspire someone with more knowledge of the callback systems.&lt;br&gt;
&lt;br&gt;
N=100;&lt;br&gt;
BEEN_DONE_VEC=false(N,1)&lt;br&gt;
wait_handle=waitbar(0);&lt;br&gt;
parfor (IND=1:N)&lt;br&gt;
BEEN_DONE_VEC(IND)=true;&lt;br&gt;
waitbar(wait_handle,mean(BEEN_DONE_VEC))&lt;br&gt;
...do something&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
In this case it doesn't matter that the operations are not&lt;br&gt;
done in order, since it just updates it with the fraction of&lt;br&gt;
instances that are completed.  The only problem I have is&lt;br&gt;
figuring out how to pass an 'update' type call to waitbar.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Narfi &quot; &amp;lt;narfi.stefansson@mathworks.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fs0tg5$qdq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; William,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Currently, there is unfortunately no way of receiving&lt;br&gt;
&amp;gt; notification in the MATLAB client when an iteration is&lt;br&gt;
&amp;gt; completed on a worker.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Best,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Narfi&lt;br&gt;
&amp;gt; &quot;William Dampier&quot; &amp;lt;walldo2@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;fs0m5p$nkd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I was wondering if anyone has found a way to do progressbars&lt;br&gt;
&amp;gt; &amp;gt; for the new parfor loops in R2007b and 2008a.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; For normal for-loops the simple waitbar command works well.&lt;br&gt;
&amp;gt; &amp;gt; waitbar(0)&lt;br&gt;
&amp;gt; &amp;gt; for i=1:N&lt;br&gt;
&amp;gt; &amp;gt; waitbar(i/N)&lt;br&gt;
&amp;gt; &amp;gt; ...do something&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; however it doesn't work with the parfor loops, since things&lt;br&gt;
&amp;gt; &amp;gt; aren't done in order.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Has anybody made a function or found a work-around?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks&lt;br&gt;
&amp;gt; &amp;gt; Will&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 19:27:03 -0500</pubDate>
      <title>Re: waitbar for parfor loops</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166139#691813</link>
      <author>jochen Kamm</author>
      <description>&amp;gt; N=100;&lt;br&gt;
&amp;gt; BEEN_DONE_VEC=false(N,1)&lt;br&gt;
&amp;gt; wait_handle=waitbar(0);&lt;br&gt;
&amp;gt; parfor (IND=1:N)&lt;br&gt;
&amp;gt; BEEN_DONE_VEC(IND)=true;&lt;br&gt;
&amp;gt; waitbar(wait_handle,mean(BEEN_DONE_VEC))&lt;br&gt;
&amp;gt; ...do something&lt;br&gt;
&amp;gt; end&lt;br&gt;
&lt;br&gt;
I had a similar idea. Matlab did not accept it though, since it will regard the mean(...) command (I used sum(...)) as something inconsistent as it varies with the order of the parfor loop execution - of which all results of course should be independent.&lt;br&gt;
&lt;br&gt;
I thought of something more basic then:&lt;br&gt;
&lt;br&gt;
fprintf(repmat('*',1,N));&lt;br&gt;
parfor ind = 1 : N&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fprintf('\b')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
if N is too large fractioning is be necessary. Its crude but it works.&lt;br&gt;
&lt;br&gt;
fractioning in parts n, choose n appriopriatly:&lt;br&gt;
M = numel(find(mod(1:N,n)==0));&lt;br&gt;
fprintf(repmat('*',1,M));&lt;br&gt;
parfor ind = 1 : N&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if mod(ind,n)==0; fprintf('\b'); end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;br&gt;
end</description>
    </item>
    <item>
      <pubDate>Fri, 20 Nov 2009 12:49:05 -0500</pubDate>
      <title>Re: waitbar for parfor loops</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166139#696331</link>
      <author>Gil Georges</author>
      <description>the following works for me:&lt;br&gt;
&lt;br&gt;
function testParFor()</description>
    </item>
  </channel>
</rss>

