Hi Hao,<br> Sorry for the confusion - which documentation are you looking at, out of curiosity?<br><br>Basically, my advice would be to not worry about annotating the loops unless you are seeing performance problems. The default settings for foreach loops should give good performance in
most use cases. By default they use a recursive loop splitting algorithm that is a good balance between parallelism and control-flow overhead. <br><br>Here are a few rules of thumb about specific options:<br><ul><li>The @unroll annotation is mainly useful if you have inter-iteration dependencies, as it can allow the compiler to optimize across loop iterations. E.g. in the example below it could save an array lookup by optimizing across iterations after unrolling:</li>
</ul><p><font face="courier new,monospace">foreach x, i in A {</font></p><font face="courier new,monospace"> B[i] = A[i] + A[i+1];</font><br><p><font face="courier new,monospace">}</font><br></p>
<div class="gmail_extra"><ul><li>The @async annotation is rarely if ever useful: it tends to add
additional overhead from more task spawns without meaningfully
increasing parallelism, since any leaf functions within the loop body are spawned off as tasks regardless. <br></li></ul>- Tim<br><br><div class="gmail_quote">On Fri, Nov 9, 2012 at 1:39 AM, Hao Yang <span dir="ltr"><<a href="mailto:yanghao0614@gmail.com" target="_blank">yanghao0614@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, all: <div><br></div><div>I am trying Swift/Turbine Compiler (STC). It seems that for foreach loops, the default mode is to run every iteration locally, if @async annotation is provided, then the iterations will be launched on other remote turbine engines, if there is app function inside a iteration, the iterations will be launched on workers. I am wondering what is the criteria for making these decisions (whether to run locally, on other engines or on workers) if the goal is to optimize the performance? If @unroll annotation is used to optimize performance, how can one choose a good unrolling factor? </div>
<div><br></div><div>Thank you. <span><font color="#888888"><br clear="all"><div><br></div>-- <br>Best Regards, <br>Hao Yang<div>Networked Systems Laboratory</div><div>Electrical and Computer Engineering<div>
The University of British Columbia<br><div>
<div><br></div></div></div></div><br>
</font></span></div>
<br>_______________________________________________<br>
Swift-user mailing list<br>
<a href="mailto:Swift-user@ci.uchicago.edu" target="_blank">Swift-user@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user</a><br></blockquote></div><br></div>