<?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 In your original code, on the in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987018#M27412</link>
    <description>&lt;P&gt;In your original code, on the host, what you see in the source code is p_simple, what you are actually using is this-&amp;gt;p_simple. On the offload side, the code is only seeing p_simple without a corresponding this object. By making it a local variable (float *p_tmp = p_simple;) you've removed the hidden "this-&amp;gt;".&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jun 2014 20:15:42 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2014-06-06T20:15:42Z</dc:date>
    <item>
      <title>MIC offload using C++</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987014#M27408</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to port a C++ code using the offload mic directives. I have developed a toy code,&lt;/P&gt;

&lt;P&gt;but I cannot manage offload computations using member classes. The code I am working on is provided below.&lt;/P&gt;

&lt;P&gt;main.cpp:&lt;/P&gt;

&lt;P&gt;[cpp]#include "foo.h"&lt;/P&gt;

&lt;P&gt;int main()&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foo fo(2,2,2);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fo.transfer_on_mic();&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fo.compute();&lt;BR /&gt;
	}[/cpp]&lt;/P&gt;

&lt;P&gt;foo.cpp:&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;#include "foo.h"&lt;BR /&gt;
	#include "work.h"&lt;BR /&gt;
	foo::foo(int size1_,int size2_,int size3_):size1(size1_),size2(size2_),size3(size3_)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_simple=new float[size1*size2*size3];&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i=0;i&amp;lt;size1;i++)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int j=0;j&amp;lt;size2;j++)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int k=0;k&amp;lt;size3;k++)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_simple[i*size3*size2+j*size3+k] = 23.F;&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;void foo::transfer_on_mic()&lt;BR /&gt;
	{&lt;BR /&gt;
	#pragma offload_transfer target(mic:1) in(p_simple:length(size1*size2*size3) alloc_if(1) free_if(0))&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;void foo::compute()&lt;BR /&gt;
	{&lt;BR /&gt;
	#pragma offload target(mic:1) in(p_simple:length(0) alloc_if(0) free_if(0))&lt;BR /&gt;
	&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; work_simple(p_simple,size1,size2,size3);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;

&lt;P&gt;work.cpp&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;
	#include "work.h"&lt;/P&gt;

&lt;P&gt;__declspec(target(mic)) void work_simple(float *field,int maxi,int maxj ,int maxk)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i=0;i&amp;lt;maxi;i++)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int j=0;j&amp;lt;maxj;j++)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int k=0;k&amp;lt;maxk;k++)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("%f \n", field[i*maxk*maxj+j*maxk+k]);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;#ifndef FOO_H&lt;BR /&gt;
	#define FOO_H&lt;BR /&gt;
	#pragma offload_attribute (push,target(mic))&lt;BR /&gt;
	struct foo{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foo(int ,int ,int);&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void transfer_on_mic();&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void compute();&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float *p_simple;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int size1,size2,size3;&lt;BR /&gt;
	};&lt;BR /&gt;
	#pragma offload_attribute (pop)&lt;BR /&gt;
	#endif&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;

&lt;P&gt;[cpp]&lt;/P&gt;

&lt;P&gt;#ifndef WORK_H&lt;BR /&gt;
	#define WORK_H&lt;BR /&gt;
	__declspec(target(mic)) void work_simple(float *field,int,int,int);&lt;BR /&gt;
	#endif&lt;/P&gt;

&lt;P&gt;[/cpp]&lt;/P&gt;

&lt;P&gt;The offload_trasfer seems to work, while the offloaded computation results in a sigsegv error.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Francesco&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2013 18:38:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987014#M27408</guid>
      <dc:creator>Salvadore__Francesco</dc:creator>
      <dc:date>2013-11-19T18:38:50Z</dc:date>
    </item>
    <item>
      <title>foo.cpp fails to compile. I</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987015#M27409</link>
      <description>&lt;P&gt;foo.cpp fails to compile. I believe the code I have is what was provided but I'll check again.&lt;/P&gt;

&lt;P&gt;$ icpc -c foo.cpp&lt;BR /&gt;
	foo.cpp(16): error: invalid entity for this variable list in&lt;BR /&gt;
	&amp;nbsp; #pragma offload_transfer target(mic:1) in(p_simple : lengt&lt;BR /&gt;
	&amp;nbsp;alloc_if(1) free_if(0))&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^&lt;/P&gt;

&lt;P&gt;foo.cpp(21): error: invalid entity for this variable list in&lt;BR /&gt;
	&amp;nbsp; #pragma offload target(mic:1) in(p_simple : length(0) allo&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^&lt;/P&gt;

&lt;P&gt;compilation aborted for foo.cpp (code 2)&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2013 21:46:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987015#M27409</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2013-11-19T21:46:58Z</dc:date>
    </item>
    <item>
      <title>Development’s guidance is</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987016#M27410</link>
      <description>&lt;P&gt;Development’s guidance is that p_simple is a data member of the class, we don't support its usage in offload clauses, and we started diagnosing this in 14.0, which is why I suffered the compilation error. I confirmed this code compiled successfully with 13.1 but suffers the seg-fault you noted.&lt;/P&gt;

&lt;P&gt;We have an open feature request for this support in a future release (internal tracking id below) and I will keep this thread updated on the availability of that support in a future release as I learn it.&lt;/P&gt;

&lt;P&gt;There is a work around available of using a temporary pointer. This is accomplished with the following changes:&lt;/P&gt;

&lt;P&gt;In foo.h, after line 16, add the following declaration:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static float *p_tmp;&lt;/P&gt;

&lt;P&gt;In foo.cpp, make the following changes:&lt;/P&gt;

&lt;P&gt;1. After line 22 (before the offload_transfer), add this assignment:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_tmp = p_simple;&lt;/P&gt;

&lt;P&gt;2. On lines 23, 30, and 34, change the reference for p_simple to p_tmp.&lt;/P&gt;

&lt;P&gt;These changes are using with both 13.1 and 14.0 compilers.&lt;/P&gt;

&lt;P&gt;(Internal tracking id: DPD200356158)&lt;BR /&gt;
	&lt;STRONG&gt;(Resolution Update on 09/16/2014):&lt;/STRONG&gt; This defect is fixed in the Intel® Parallel Studio XE 2015 Initial Release (2015.0.090 - Linux)&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2013 20:22:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987016#M27410</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2013-11-21T20:22:00Z</dc:date>
    </item>
    <item>
      <title>What exactly is the</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987017#M27411</link>
      <description>&lt;P&gt;What exactly is the requirement for p_simple? Just not a class member?&lt;/P&gt;

&lt;P&gt;In my case a global variable would be not so nice. So I tried it with a method local variable. In this example I just put&lt;/P&gt;

&lt;P&gt;float *p_tmp = p_simple;&lt;/P&gt;

&lt;P&gt;in front of the offloads in transfer_on_mic and compute, and removed the&lt;/P&gt;

&lt;P&gt;static float *p_tmp;&lt;/P&gt;

&lt;P&gt;from the header. And it does work. Is this supposed to work, or do I have to be careful here?&lt;/P&gt;

&lt;P&gt;I want to use it for a slightly more complicated problem, but I probably start a new thread for that.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 18:46:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987017#M27411</guid>
      <dc:creator>Christof_Soeger</dc:creator>
      <dc:date>2014-06-06T18:46:49Z</dc:date>
    </item>
    <item>
      <title>In your original code, on the</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987018#M27412</link>
      <description>&lt;P&gt;In your original code, on the host, what you see in the source code is p_simple, what you are actually using is this-&amp;gt;p_simple. On the offload side, the code is only seeing p_simple without a corresponding this object. By making it a local variable (float *p_tmp = p_simple;) you've removed the hidden "this-&amp;gt;".&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jun 2014 20:15:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987018#M27412</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-06-06T20:15:42Z</dc:date>
    </item>
    <item>
      <title>Feature support for using a</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987019#M27413</link>
      <description>&lt;P&gt;Feature support for using a data member of the class within the offload clause is now available in the latest &lt;STRONG&gt;Intel® Parallel Studio XE 2015&lt;/STRONG&gt; initial release for both Linux and Windows.&lt;/P&gt;

&lt;P&gt;The test case in the original post successfully compiles and produces expected results using the &lt;STRONG&gt;Intel® Parallel Studio XE 2015&lt;/STRONG&gt; Initial Release (2015.0.090 - Linux).&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2014 10:53:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987019#M27413</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-09-16T10:53:04Z</dc:date>
    </item>
    <item>
      <title>Woow!</title>
      <link>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987020#M27414</link>
      <description>&lt;P&gt;Woow!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 16:56:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/MIC-offload-using-C/m-p/987020#M27414</guid>
      <dc:creator>KIMATHI__ONESMUS</dc:creator>
      <dc:date>2018-09-06T16:56:23Z</dc:date>
    </item>
  </channel>
</rss>

