Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>MATLAB cannot determine that your loop is order independent because of the way you're accessing correlations(1) from multiple iterations of the PARFOR loop. It looks like this value is in some way 'special', it should work to make a 'reduction' variable, i.e. replace <code>correlations(1)</code> with <code>correlations_1</code> or something.</p> <p>The next problem you'll encounter is that you are not correctly 'slicing' the remainder of <code>correlations</code>. For MATLAB to analyse a PARFOR loop, it needs to be able to tell that each loop iteration is writing only to its 'slice' of the output variables. In practice, this means that you must index the outputs using literally the loop index.</p> <p>More about PARFOR variable classification here: <a href="http://www.mathworks.com/help/distcomp/advanced-topics.html#bq_of7_-1" rel="nofollow">http://www.mathworks.com/help/distcomp/advanced-topics.html#bq_of7_-1</a></p> <p>EDIT:</p> <p>If you want <code>correlations</code> to behave strictly as a reduction variable as I believe you imply in your comments, you need to give PARFOR a clue that's what you mean: in particular, you need to add to the whole variable each time you need to. In other words, something more like:</p> <pre><code>parfor ... dummyVec = zeros(1, N); dummyVec(elementToIncrement) = 1; correlations = correlations + dummyVec; end </code></pre> <p>I agree this is non-obvious. See <a href="http://blogs.mathworks.com/cleve/2012/11/26/magic-squares-meet-supercomputing/" rel="nofollow">http://blogs.mathworks.com/cleve/2012/11/26/magic-squares-meet-supercomputing/</a> for more.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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