<?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 cil_spawn ing a function in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/cil-spawn-ing-a-function/m-p/741338#M555</link>
    <description>How does one cilk_spawn the function:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;isprime when it is called like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if (isprime(i)) {printf (%d ", i) };&lt;BR /&gt;&lt;BR /&gt;it is embbeded in a if statements. i do not think thta&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if(cilk_spawn (isprimei)) will work.&lt;BR /&gt;&lt;BR /&gt;Any help appreciated.&lt;BR /&gt;&lt;BR /&gt;newport_j</description>
    <pubDate>Fri, 09 Mar 2012 22:35:02 GMT</pubDate>
    <dc:creator>newport_j</dc:creator>
    <dc:date>2012-03-09T22:35:02Z</dc:date>
    <item>
      <title>cil_spawn ing a function</title>
      <link>https://community.intel.com/t5/Software-Archive/cil-spawn-ing-a-function/m-p/741338#M555</link>
      <description>How does one cilk_spawn the function:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;isprime when it is called like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if (isprime(i)) {printf (%d ", i) };&lt;BR /&gt;&lt;BR /&gt;it is embbeded in a if statements. i do not think thta&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if(cilk_spawn (isprimei)) will work.&lt;BR /&gt;&lt;BR /&gt;Any help appreciated.&lt;BR /&gt;&lt;BR /&gt;newport_j</description>
      <pubDate>Fri, 09 Mar 2012 22:35:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/cil-spawn-ing-a-function/m-p/741338#M555</guid>
      <dc:creator>newport_j</dc:creator>
      <dc:date>2012-03-09T22:35:02Z</dc:date>
    </item>
    <item>
      <title>cil_spawn ing a function</title>
      <link>https://community.intel.com/t5/Software-Archive/cil-spawn-ing-a-function/m-p/741339#M556</link>
      <description>&lt;P&gt;You are correct in saying that if(cilk_spawn is_prime(i)) { printf("%d", i) } won't work.&lt;BR /&gt;&lt;BR /&gt;On a syntactic level, "cilk_spawn is_prime(i)" is a statement, not an expression, so that code would not compile. One way toget a code that compiles is to declare a temporary to store the return value:&lt;BR /&gt;&lt;BR /&gt;int is_prime_ans = cilk_spawn is_prime(i);&lt;BR /&gt;cilk_sync;&lt;BR /&gt;if (is_prime_ans) { printf("%d", i); }&lt;BR /&gt;&lt;BR /&gt;On the other hand, since you need toreach a cilk_sync before you can read the value computed by "is_prime()", it is not useful to have the cilk_spawn unless there is some other code that can be executed before the cilk_sync. &lt;BR /&gt;&lt;BR /&gt;Does that help for your actual code?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2012 00:20:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/cil-spawn-ing-a-function/m-p/741339#M556</guid>
      <dc:creator>Jim_S_Intel</dc:creator>
      <dc:date>2012-03-10T00:20:43Z</dc:date>
    </item>
  </channel>
</rss>

