<?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 I may be wrong on this, but in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086405#M63563</link>
    <description>&lt;P&gt;I may be wrong on this, but the scope of the function complex_add, is that of a global function inside the mic (not on host).&lt;/P&gt;

&lt;P&gt;Your declare pragma is issued in the scope of the main (host) program... no such symbol.&lt;/P&gt;

&lt;P&gt;What happens when you move line 23 to line 27? (inside the MIC/offload region)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jun 2016 16:19:00 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2016-06-06T16:19:00Z</dc:date>
    <item>
      <title>Offloading of a simple code that includes a User Defined Reduction</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086402#M63560</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;

&lt;P&gt;I am trying to compile with the latest Intel compiler (version 16.0.3) the following simple code in which an OpenMP v4.x user defined reduction is offloaded to a MIC.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#pragma offload_attribute (push,target(mic))
#include &amp;lt;stdio.h&amp;gt;

typedef struct {
   double real;
   double imag;
} complex_t;

complex_t complex_add (complex_t a, complex_t b)
{
   complex_t c;
   c.real = a.real + b.real;
   c.imag = a.imag + b.imag;
   return c;
}

#pragma offload_attribute (pop)

int main ()
{
   complex_t x;

#pragma omp declare reduction(cmplxAdd: complex_t: omp_out=complex_add(omp_out, omp_in)) initializer( omp_priv={0.0, 0.0} )
#pragma offload target(mic) out(x)
   {
      x = (complex_t) {0.0, 0.0};

#pragma omp parallel num_threads(48) reduction(cmplxAdd: x)
      {
         x = (complex_t) {1.0, -1.0};
      }
   }

   printf ("Done: result is  %f,%f\n", x.real, x.imag);
}&lt;/PRE&gt;

&lt;P&gt;The code is compiled using&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;icc -O3 -qopenmp -o mytest mytest.c&lt;/PRE&gt;

&lt;P&gt;The compiler fails, producing the following error message:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;/tmp/iccI8DGFd.o: In function `main':
main.c:(.text+0x199): undefined reference to `__udr_i_0x4633c48'
main.c:(.text+0x1d6): undefined reference to `__udr_c_0x4633658'&lt;/PRE&gt;

&lt;P&gt;If I understand correctly, the first undefined reference is for the user defined reduction initializer, and the second one for the user defined reduction combiner (the reduction function). However, searching the Internet for related documentation I was not able to find anything about. What should I do to properly compile the code ? Am I missing linking one or more specific libraries ?&lt;/P&gt;

&lt;P&gt;Thank you in advance for your kind assistance.&lt;/P&gt;

&lt;P&gt;Italo Epicoco&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 11:16:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086402#M63560</guid>
      <dc:creator>Italo_E_</dc:creator>
      <dc:date>2016-06-06T11:16:24Z</dc:date>
    </item>
    <item>
      <title>The cause of the undefined</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086403#M63561</link>
      <description>&lt;P&gt;The cause of the undefined references is unclear so I’m consulting w/Developers. Even a pure OpenMP version (i.e. no mixing of Intel’s LEO + OpenMP) produces the same undefined references.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 12:59:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086403#M63561</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2016-06-06T12:59:10Z</dc:date>
    </item>
    <item>
      <title>Dear Kevin,</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086404#M63562</link>
      <description>&lt;P&gt;Dear Kevin,&lt;/P&gt;

&lt;P&gt;thanks for your reply. Please also consider that when compiled in native mode (with -mmic flag) the "pure" OpenMP code does not produce any error&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 14:09:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086404#M63562</guid>
      <dc:creator>Italo_E_</dc:creator>
      <dc:date>2016-06-06T14:09:00Z</dc:date>
    </item>
    <item>
      <title>I may be wrong on this, but</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086405#M63563</link>
      <description>&lt;P&gt;I may be wrong on this, but the scope of the function complex_add, is that of a global function inside the mic (not on host).&lt;/P&gt;

&lt;P&gt;Your declare pragma is issued in the scope of the main (host) program... no such symbol.&lt;/P&gt;

&lt;P&gt;What happens when you move line 23 to line 27? (inside the MIC/offload region)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 16:19:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086405#M63563</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2016-06-06T16:19:00Z</dc:date>
    </item>
    <item>
      <title>Development confirmed this</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086406#M63564</link>
      <description>&lt;P&gt;Development confirmed this was a compiler defect. The compiler is not generating the user defined reduction for the target and this results in the undefined references. I escalated&amp;nbsp;this to&amp;nbsp;our internal tracking system (see id below) and will keep this post updated on the progress of a fix. Unfortunately there was no work around offered at this time but I will share if one comes to light.&lt;/P&gt;

&lt;P&gt;(Internal tracking id: DPD200411555)&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 18:41:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-of-a-simple-code-that-includes-a-User-Defined/m-p/1086406#M63564</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2016-06-06T18:41:05Z</dc:date>
    </item>
  </channel>
</rss>

