<p dir="auto">As discussed with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/JeffBezanson/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/JeffBezanson">@JeffBezanson</a> in the Slack, <code class="notranslate">@threads</code> still uses a static schedule. However, there are some cases where we are using it as a simple way to express a lot of similar computations to be done on threads, each of which is actually quite expensive and not the same size. Thus for our purposes it would make sense to utilize <code class="notranslate">@par</code> to get the dynamic scheduling, but it makes sense "aesthetics-wise" to just put <code class="notranslate">@threads</code> on the loop. Thus it would make sense to have something like <code class="notranslate">@threads dynamic for i in ...</code> where</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="macro par(expr)
    thunk = esc(:(()-&gt;($expr)))
    quote
        local task = Task($thunk)
        task.sticky = false
        schedule(task)
        task
    end
end"><pre class="notranslate"><span class="pl-k">macro</span> <span class="pl-en">par</span>(expr)
    thunk <span class="pl-k">=</span> <span class="pl-c1">esc</span>(:(()<span class="pl-k">-&gt;</span>(<span class="pl-k">$</span>expr)))
    <span class="pl-k">quote</span>
        <span class="pl-k">local</span> task <span class="pl-k">=</span> <span class="pl-c1">Task</span>(<span class="pl-k">$</span>thunk)
        task<span class="pl-k">.</span>sticky <span class="pl-k">=</span> <span class="pl-c1">false</span>
        <span class="pl-c1">schedule</span>(task)
        task
    <span class="pl-k">end</span>
<span class="pl-k">end</span></pre></div>
<p dir="auto">it turns the loop</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="_f = (i) -&gt; # inner expression of the loop
for i in 1:100
  @par _f(i)
end"><pre class="notranslate">_f <span class="pl-k">=</span> (i) <span class="pl-k">-&gt;</span> <span class="pl-c"><span class="pl-c">#</span> inner expression of the loop</span>
<span class="pl-k">for</span> i <span class="pl-k">in</span> <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">100</span>
  <span class="pl-c1">@par</span> <span class="pl-c1">_f</span>(i)
<span class="pl-k">end</span></pre></div>
<p dir="auto">If I'm not mistaken that's all that's necessary?</p>
<p dir="auto">Apologies if this is a duplicate - did a quick search, couldn't find any issues related to this. Just started learning Julia. When learning a language I prefer to download documentation and read it off-line during commutes.</p>
<p dir="auto">There is a minor annoyance with the downloadable html version of the documentation as is: the in-document hyperlinks end with a forward slash (for example "julia-latest/manual/parallel-computing/") but to be valid they should end with the "index.html" document ("julia-latest/manual/parallel-computing/index.html").</p>