<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic One of your loops has a race  in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949977#M19263</link>
    <description>&lt;P&gt;One of your loops&amp;nbsp;has a race ---&amp;nbsp;each iteration of the&amp;nbsp;following loop&amp;nbsp;modifies&amp;nbsp;the same j.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;j = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;cilk_for (int i = 1; i &amp;lt; n; i += 2) { &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (j &amp;gt; i) { &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempr = data&lt;J&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;J&gt; = data&lt;I&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;I&gt; = tempr;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tempr = data[j+1]; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data[j+1] = data[i+1]; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data[i+1] = tempr; } &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m = n &amp;gt;&amp;gt; 1; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (m &amp;gt;= 2 &amp;amp;&amp;amp; j &amp;gt; m) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j -= m; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m &amp;gt;&amp;gt;= 1;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j += m; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;There could be other similar errors in your program --- I didn't check the rest of the program too carefully.&lt;BR /&gt;Using Cilk screen to race-detect your program may help eliminate some of these errors.&lt;/I&gt;&lt;/I&gt;&lt;/J&gt;&lt;/J&gt;&lt;/P&gt;
&lt;P&gt;More generally, I would also question whether implementing your own FFT is actually the most efficient way to solve your problem.&amp;nbsp;&amp;nbsp; I would think that using an existing optimized library would likely be more efficient in terms of both performance and development effort.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Jim&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2013 13:42:31 GMT</pubDate>
    <dc:creator>Jim_S_Intel</dc:creator>
    <dc:date>2013-05-06T13:42:31Z</dc:date>
    <item>
      <title>Convert regular FFT code to cilk</title>
      <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949975#M19261</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;The attached code is an FFT implementation. It should work on any input vector length&lt;/P&gt;
&lt;P&gt;I converted each for loop into a clik_for loop.&lt;/P&gt;
&lt;P&gt;When I did it in line "for (i = 1; i &amp;lt; n; i += 2)" the results of the FFT were wrong.&lt;/P&gt;
&lt;P&gt;There is also a probem with the while loops.&lt;/P&gt;
&lt;P&gt;I tried to convert: "while (n &amp;gt; mmax)" to "cilk_for (;n&amp;gt;mmax;)" but I got a syntax error: missing control variable declaration and initialization.&lt;/P&gt;
&lt;P&gt;What is the right way&amp;nbsp;to convert a regular FFT code to a clik code ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Zvika &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2013 09:59:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949975#M19261</guid>
      <dc:creator>Zvi_Vered</dc:creator>
      <dc:date>2013-05-06T09:59:06Z</dc:date>
    </item>
    <item>
      <title>I don't see any cilk_for in</title>
      <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949976#M19262</link>
      <description>&lt;P&gt;I don't see any cilk_for in the attachment.&amp;nbsp; Did you hope for "clik_for" to be so interpreted?&amp;nbsp; How could it compile successfully?&lt;/P&gt;
&lt;P&gt;As you saw, cilk_for is strict about requiring all the fields to be filled in in such a way that the loop is countable, and none of the parameters are modified elsewhere in the loop.&amp;nbsp; It's a parallelization construct, so need not accept anything which is not parallelizable.&lt;/P&gt;
&lt;P&gt;Are you certain that you want nested parallelism as your first step?&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2013 13:28:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949976#M19262</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2013-05-06T13:28:03Z</dc:date>
    </item>
    <item>
      <title>One of your loops has a race</title>
      <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949977#M19263</link>
      <description>&lt;P&gt;One of your loops&amp;nbsp;has a race ---&amp;nbsp;each iteration of the&amp;nbsp;following loop&amp;nbsp;modifies&amp;nbsp;the same j.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;j = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;cilk_for (int i = 1; i &amp;lt; n; i += 2) { &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (j &amp;gt; i) { &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempr = data&lt;J&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;J&gt; = data&lt;I&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;I&gt; = tempr;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tempr = data[j+1]; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data[j+1] = data[i+1]; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data[i+1] = tempr; } &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m = n &amp;gt;&amp;gt; 1; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (m &amp;gt;= 2 &amp;amp;&amp;amp; j &amp;gt; m) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j -= m; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m &amp;gt;&amp;gt;= 1;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j += m; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;There could be other similar errors in your program --- I didn't check the rest of the program too carefully.&lt;BR /&gt;Using Cilk screen to race-detect your program may help eliminate some of these errors.&lt;/I&gt;&lt;/I&gt;&lt;/J&gt;&lt;/J&gt;&lt;/P&gt;
&lt;P&gt;More generally, I would also question whether implementing your own FFT is actually the most efficient way to solve your problem.&amp;nbsp;&amp;nbsp; I would think that using an existing optimized library would likely be more efficient in terms of both performance and development effort.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2013 13:42:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949977#M19263</guid>
      <dc:creator>Jim_S_Intel</dc:creator>
      <dc:date>2013-05-06T13:42:31Z</dc:date>
    </item>
    <item>
      <title>The code has races on m, j,wr</title>
      <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949978#M19264</link>
      <description>&lt;P&gt;The code has races on m, j,wr, wi, tempr, tempi. &amp;nbsp;The example demonstrates a common difficulty with parallelizing serial code: the serial code makes heavy use of induction variables, that is variables whose value is incrementally updated on each iteration based on the variable's value in the previous iteration. &amp;nbsp;For example, wr/wi are being computed based on their values in the previous iteration of the m-loop. &amp;nbsp;You'll need to change the calculation to compute their value's from scratch. &amp;nbsp;Typically production-strength FFTs precompute a lookup table for these values (often called "twiddle factors"). &amp;nbsp;Likewise the calculations of m and j need to be done in a way that does not depend on their previous values.&lt;/P&gt;
&lt;P&gt;Some general advice: always declare variables in the innermost scope possible. &amp;nbsp;For example, tempr should be declared inside the two blocks that it is used. &amp;nbsp;That will eliminate the race on tempr. &amp;nbsp;The race on tempi can be eliminated in a similar way.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2013 14:19:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949978#M19264</guid>
      <dc:creator>ARCH_R_Intel</dc:creator>
      <dc:date>2013-05-06T14:19:23Z</dc:date>
    </item>
    <item>
      <title>Dear Members,</title>
      <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949979#M19265</link>
      <description>&lt;P&gt;Dear Members,&lt;/P&gt;
&lt;P&gt;I will search a simpler C code and try to "cilk" it.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Zvika&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2013 18:56:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949979#M19265</guid>
      <dc:creator>Zvi_Vered</dc:creator>
      <dc:date>2013-05-06T18:56:30Z</dc:date>
    </item>
    <item>
      <title>Remember that if you haven't</title>
      <link>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949980#M19266</link>
      <description>Remember that if you haven't checked for races, they are almost certainly lurking in your code.  The Cilk Tools include the Cilkscreen Race Detector and the Cilkview Scalability Analyzer.  They're available as a free download from &lt;A href="http://cilkplus.org/download" target="_blank"&gt;http://cilkplus.org/download&lt;/A&gt;

    - Barry</description>
      <pubDate>Mon, 06 May 2013 19:00:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Convert-regular-FFT-code-to-cilk/m-p/949980#M19266</guid>
      <dc:creator>Barry_T_Intel</dc:creator>
      <dc:date>2013-05-06T19:00:32Z</dc:date>
    </item>
  </channel>
</rss>

