<?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 Xeon Phi Cilk Offload: problem with libraries in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021466#M38415</link>
    <description>&lt;P&gt;I try to use Cilk_offload on host + Xeon Phi. example.cpp:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#pragma offload_attribute (push, _Cilk_shared)
#include &amp;lt;vector&amp;gt;
#include &amp;lt;string&amp;gt;
#include "offload.h"
#pragma offload_attribute(pop)
         
int main(const int argc, const char *argv[]) {      
    return 0;
}  
&lt;/PRE&gt;

&lt;P&gt;Building: &lt;STRONG&gt;icc example.cpp -o example&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;When I try to run it, I get the following error:&lt;/P&gt;

&lt;P&gt;On the sink, dlopen() returned NULL. The result of dlerror() is "/var/volatile/tmp/coi_procs/1/6847/load_lib/iccoutY1s4hB: undefined symbol: pthread_cancel_wrapper"&lt;BR /&gt;
	On the remote process, dlopen() failed. The error message sent back from the sink is /var/volatile/tmp/coi_procs/1/6847/load_lib/iccoutY1s4hB: undefined symbol: pthread_cancel_wrapper&lt;BR /&gt;
	offload error: cannot load library to the device 0 (error code 20)&lt;/P&gt;

&lt;P&gt;And if I remove "#include &amp;lt;string&amp;gt;", everything is ok.&lt;/P&gt;

&lt;P&gt;I need &amp;lt;vector&amp;gt; and &amp;lt;string&amp;gt; in a complex program where I have the same problem.&lt;/P&gt;

&lt;P&gt;What should I do?&lt;/P&gt;</description>
    <pubDate>Fri, 12 Dec 2014 13:17:06 GMT</pubDate>
    <dc:creator>Elizaveta_G_</dc:creator>
    <dc:date>2014-12-12T13:17:06Z</dc:date>
    <item>
      <title>Xeon Phi Cilk Offload: problem with libraries</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021466#M38415</link>
      <description>&lt;P&gt;I try to use Cilk_offload on host + Xeon Phi. example.cpp:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#pragma offload_attribute (push, _Cilk_shared)
#include &amp;lt;vector&amp;gt;
#include &amp;lt;string&amp;gt;
#include "offload.h"
#pragma offload_attribute(pop)
         
int main(const int argc, const char *argv[]) {      
    return 0;
}  
&lt;/PRE&gt;

&lt;P&gt;Building: &lt;STRONG&gt;icc example.cpp -o example&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;When I try to run it, I get the following error:&lt;/P&gt;

&lt;P&gt;On the sink, dlopen() returned NULL. The result of dlerror() is "/var/volatile/tmp/coi_procs/1/6847/load_lib/iccoutY1s4hB: undefined symbol: pthread_cancel_wrapper"&lt;BR /&gt;
	On the remote process, dlopen() failed. The error message sent back from the sink is /var/volatile/tmp/coi_procs/1/6847/load_lib/iccoutY1s4hB: undefined symbol: pthread_cancel_wrapper&lt;BR /&gt;
	offload error: cannot load library to the device 0 (error code 20)&lt;/P&gt;

&lt;P&gt;And if I remove "#include &amp;lt;string&amp;gt;", everything is ok.&lt;/P&gt;

&lt;P&gt;I need &amp;lt;vector&amp;gt; and &amp;lt;string&amp;gt; in a complex program where I have the same problem.&lt;/P&gt;

&lt;P&gt;What should I do?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 13:17:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021466#M38415</guid>
      <dc:creator>Elizaveta_G_</dc:creator>
      <dc:date>2014-12-12T13:17:06Z</dc:date>
    </item>
    <item>
      <title>When you use the C compiler</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021467#M38416</link>
      <description>&lt;P&gt;When you use the C compiler to link C++ and maybe invoke some cilk without specifying appropriate libraries, annoying things may happen.&amp;nbsp; Doesn't that sample directory offer hints such as&lt;/P&gt;

&lt;P&gt;icpc example.cpp -lcilkrts&lt;/P&gt;

&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:38:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021467#M38416</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2014-12-12T16:38:12Z</dc:date>
    </item>
    <item>
      <title>I am unable to reproduce that</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021468#M38417</link>
      <description>&lt;P&gt;I am unable to reproduce that error with the test case as is so perhaps I'm not using the same icc and/or MPSS that you are or it is missing something. Can you tell me the versions of icc and MPSS you have?&lt;/P&gt;

&lt;P&gt;I can induce the failure with the 14.0 compiler when adding &amp;lt;iostream&amp;gt; into the push/pop _Cilk_shared block so maybe that's what your larger C++ program also does. From that past instance it was learned that &amp;lt;iostream&amp;gt; cannot be included in the _Cilk_Shared due to the fact the library is not built with _Cilk_shared. That could spell bigger issues to face depending on the needs of the larger complex C++ program.&lt;/P&gt;

&lt;P&gt;I don't know how much of your complex C++ program can be shared (even in private with us) or whether you could construct a more complete mock-up that represented the issue, if so we might be able to offer help on getting the program enabled with _Cilk_offload or determine if there are roadblocks to doing that.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 16:46:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021468#M38417</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-12-12T16:46:00Z</dc:date>
    </item>
    <item>
      <title>Same results here: cannot</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021469#M38418</link>
      <description>&lt;P&gt;Same results here: cannot reproduce using either icc14 or icc15; if I add &amp;lt;iostring&amp;gt; I cannot even compile the code using icc15:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;&amp;gt; icpc -o offload3a offload3a.cpp -lcilkrts
/tmp/icpcdZzHxF.o:(.MyoFptrTable.[pthread_cancel_myo_thunk_fptr_$MyoTable]+0x10): undefined reference to `pthread_cancel_wrapper'
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 17:18:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021469#M38418</guid>
      <dc:creator>JJK</dc:creator>
      <dc:date>2014-12-12T17:18:22Z</dc:date>
    </item>
    <item>
      <title>Yes. 15.0 is producing a</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021470#M38419</link>
      <description>&lt;P&gt;Yes. 15.0 is producing a Linux executable binary for the offload image which by default does not permit undefined references where as 14.0 produces the Linux shared object binary which does and so the undefined reference is not exposed until runtime. With 14.0 (and earlier) you can flush out the undefined reference at link time by adding &lt;STRONG&gt;-z defs&lt;/STRONG&gt; to the offload link.&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.4.211 Build 20140805

$ icc u537189.cpp -offload-option,mic,ld,"-z defs"
/tmp/icczHywsc.o:(.MyoFptrTable.[pthread_cancel_myo_thunk_fptr_$MyoTable]+0x10): undefined reference to `pthread_cancel_wrapper'&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 17:31:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021470#M38419</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-12-12T17:31:51Z</dc:date>
    </item>
    <item>
      <title>I haven't found the symbol</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021471#M38420</link>
      <description>&lt;P&gt;I haven't found the symbol 'pthread_cancel_wrapper' in libraries, Google (- anywhere!) And when I've added the following&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;extern "C" { __attribute__((target(mic))) void pthread_cancel_wrapper() {} }&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;to my code, it works!&lt;BR /&gt;
	&lt;BR /&gt;
	My software:&lt;BR /&gt;
	icc version 13.0.1 from Intel Composer_xe_2013.1.117&lt;BR /&gt;
	mpss version 3.4.1&lt;BR /&gt;
	libc versions:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; on host:&amp;nbsp; libc-2.11.3.so&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; on MIC:&amp;nbsp;&amp;nbsp; libc-2.14.90.so&lt;BR /&gt;
	&lt;BR /&gt;
	I will use this workaround, but the question is - who does generate this symbol?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 17:41:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021471#M38420</guid>
      <dc:creator>Elizaveta_G_</dc:creator>
      <dc:date>2014-12-12T17:41:52Z</dc:date>
    </item>
    <item>
      <title>Thank you for the</title>
      <link>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021472#M38421</link>
      <description>&lt;P&gt;Thank you for the clarification. I can reproduce this using the 13.1 compiler and see now that later releases are not triggering the offload compilation or image creation with that test case but adding a simple &lt;STRONG&gt;_Cilk_shared&lt;/STRONG&gt; function (like below) is sufficient to trigger the error with later releases.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;_Cilk_shared int foo()
{
   return(1);
}&lt;/PRE&gt;

&lt;P&gt;The symbol reference is associated with Virtual Shared model runtime. I will talk with the Developers to better understand this.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2014 20:54:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Xeon-Phi-Cilk-Offload-problem-with-libraries/m-p/1021472#M38421</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-12-12T20:54:45Z</dc:date>
    </item>
  </channel>
</rss>

