Note that there are some explanatory texts on larger screens.

plurals
  1. PODoubly nested parallel for loops and their span
    primarykey
    data
    text
    <p>I'm trying to wrap my head around the idea of how parallel-for-loops work, its all rather new to me, and had read this stackoverflow thread, found here <a href="https://stackoverflow.com/questions/5918477/span-and-parallel-loop">span and parallel loop</a>, and found the top answer there really helpful. </p> <p>What I'm wondering though is if I have a parallel-for-lop that has a parallel-for-lop inside it if they will behave in the following manner (for convenience I'll let n=5 and 'to' means up to and including (&lt;=)):</p> <p>Here is the code I have in my mind:</p> <pre><code>parallel for j=1 to n{ parallel for i=1 to j-1{ Do-something } } </code></pre> <p>And this is the behavior of the threads I'm leaning towards, but would like someone to confirm if correct:</p> <pre><code>Time Action 0 Thread0 creates Thread1 1 Thread0 creates Thread2, T1 -&gt; T3 2 T0 -&gt; T4, T1 -&gt; T5 </code></pre> <p>Ok here all the threads for the outer look have been created. And now for the inner. Here subXY means thread number y of thread x:</p> <pre><code>time Action 3 T0 -&gt; SubT0t0, T1 -&gt; subT1t0, T2-&gt; SubT2t0.... //All threads have created a subthread t0 so 5 more threads created. 4 T0 -&gt; subT1t1, subT0t0 -&gt; subT2t1, T1-&gt;subT2t2, subT1t0-&gt;subT3t1... //All the subthreads created more threads AND the 'Older' threads //created subthreads under other 'Older' threads. 11 more created. 5 T0 -&gt; subT5t2, subT0t0 -&gt; subT5t3, T1 -&gt; subT5t4, subT5t5 //All threads have been created. 6 Execute command Do-something </code></pre> <p>I know this might not be the best description of what I'm thinking, but its the best I can come up with.</p> <p>Is this correct? Or would a outer loop thread only make a thread connected to him self? For example T1 would only make subT1XX threads?</p> <p>Also would the threads that do nothing at time 5 execute their commands during that time?</p> <p>It would help me immensely if someone could help me. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload