<?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 why this simple offload give Segmentation fault error in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/why-this-simple-offload-give-Segmentation-fault-error/m-p/1043275#M46923</link>
    <description>&lt;P&gt;this simple test code is this(&lt;SPAN style="line-height: 19.5120010375977px;"&gt;testclass.cpp&lt;/SPAN&gt;):&lt;/P&gt;

&lt;P&gt;#include &amp;lt;iostream&amp;gt;&lt;/P&gt;

&lt;P&gt;class TEST{&lt;BR /&gt;
	public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;double *A;&lt;BR /&gt;
	public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;TEST(double * _A){A = _A;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;void run(){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;A[1] = 0;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// double *B = A;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;std::cout&amp;lt;&amp;lt;A[1]&amp;lt;&amp;lt;std::endl;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;#pragma offload target (mic) inout(A:length(2*3))&lt;BR /&gt;
	&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; &amp;nbsp;A[1] = 1;&lt;BR /&gt;
	&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;std::cout&amp;lt;&amp;lt;A[1]&amp;lt;&amp;lt;std::endl;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	};&lt;/P&gt;

&lt;P&gt;int main()&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;double *A = (double*)_mm_malloc(sizeof(double)*2*3,64);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;TEST test(A);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;test.run();&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;.............................................................................................&lt;/P&gt;

&lt;P&gt;after complile and run ,this give me this error:&lt;/P&gt;

&lt;P&gt;[root@localhost yb]# icpc testclass.cpp&lt;/P&gt;

&lt;P&gt;[root@localhost yb]# ./a.out&lt;/P&gt;

&lt;P&gt;0&lt;/P&gt;

&lt;P&gt;Segmentation fault (core dumped)&lt;/P&gt;

&lt;P&gt;......................................................................&lt;/P&gt;

&lt;P&gt;thanks.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 01 Nov 2014 09:56:18 GMT</pubDate>
    <dc:creator>yongbei_ma_</dc:creator>
    <dc:date>2014-11-01T09:56:18Z</dc:date>
    <item>
      <title>why this simple offload give Segmentation fault error</title>
      <link>https://community.intel.com/t5/Software-Archive/why-this-simple-offload-give-Segmentation-fault-error/m-p/1043275#M46923</link>
      <description>&lt;P&gt;this simple test code is this(&lt;SPAN style="line-height: 19.5120010375977px;"&gt;testclass.cpp&lt;/SPAN&gt;):&lt;/P&gt;

&lt;P&gt;#include &amp;lt;iostream&amp;gt;&lt;/P&gt;

&lt;P&gt;class TEST{&lt;BR /&gt;
	public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;double *A;&lt;BR /&gt;
	public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;TEST(double * _A){A = _A;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;void run(){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;A[1] = 0;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// double *B = A;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;std::cout&amp;lt;&amp;lt;A[1]&amp;lt;&amp;lt;std::endl;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;#pragma offload target (mic) inout(A:length(2*3))&lt;BR /&gt;
	&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; &amp;nbsp;A[1] = 1;&lt;BR /&gt;
	&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;std::cout&amp;lt;&amp;lt;A[1]&amp;lt;&amp;lt;std::endl;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	};&lt;/P&gt;

&lt;P&gt;int main()&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;double *A = (double*)_mm_malloc(sizeof(double)*2*3,64);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;TEST test(A);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;test.run();&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;.............................................................................................&lt;/P&gt;

&lt;P&gt;after complile and run ,this give me this error:&lt;/P&gt;

&lt;P&gt;[root@localhost yb]# icpc testclass.cpp&lt;/P&gt;

&lt;P&gt;[root@localhost yb]# ./a.out&lt;/P&gt;

&lt;P&gt;0&lt;/P&gt;

&lt;P&gt;Segmentation fault (core dumped)&lt;/P&gt;

&lt;P&gt;......................................................................&lt;/P&gt;

&lt;P&gt;thanks.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Nov 2014 09:56:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/why-this-simple-offload-give-Segmentation-fault-error/m-p/1043275#M46923</guid>
      <dc:creator>yongbei_ma_</dc:creator>
      <dc:date>2014-11-01T09:56:18Z</dc:date>
    </item>
    <item>
      <title>It relates to the underlying</title>
      <link>https://community.intel.com/t5/Software-Archive/why-this-simple-offload-give-Segmentation-fault-error/m-p/1043276#M46924</link>
      <description>&lt;P&gt;It relates to the underlying "this" pointer. I need to check with someone more knowledgeable about the requirements for offload within the CLASS, but for now add the additional &lt;STRONG&gt;nocopy &lt;/STRONG&gt;clause as shown below to create an instance of the underlying "this" pointer.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma offload target (mic) nocopy(this : alloc_if(1) free_if(0)) inout(A:length(2*3))&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Nov 2014 10:58:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/why-this-simple-offload-give-Segmentation-fault-error/m-p/1043276#M46924</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-11-01T10:58:15Z</dc:date>
    </item>
  </channel>
</rss>

