<?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 Thanks Kevin! in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955529#M20693</link>
    <description>&lt;P&gt;Thanks Kevin!&lt;/P&gt;

&lt;P&gt;Will it hurt the performance to have a class instance in virtual shared memory between CPU and MIC using _Offload_shared_malloc(); especially if that class instance is accessed in critical section?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;--Sanchit&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Mar 2014 09:28:20 GMT</pubDate>
    <dc:creator>Sanchit_Misra</dc:creator>
    <dc:date>2014-03-27T09:28:20Z</dc:date>
    <item>
      <title>Offloading virtual functions?</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955526#M20690</link>
      <description>&lt;P&gt;Hi, Can we offload virtual functions. I am trying to do that using the following code and I am getting seg fault. #include &lt;IOSTREAM&gt;using namespace std; class Polygon { public: #pragma offload_attribute(push, target(mic)) virtual int area (int width, int height) { return 0; } #pragma offload_attribute(pop) int area_wrapper (int width, int height) { int c; #pragma offload target(mic:0) \ in(width, height) \ out(c) { c = this-&amp;gt;area(width, height); } return c; } }; class Rectangle: public Polygon { public: #pragma offload_attribute(push, target(mic)) int area (int width, int height) { return width * height; } #pragma offload_attribute(pop) }; class Triangle: public Polygon { public: #pragma offload_attribute(push, target(mic)) int area (int width, int height) { return (width * height / 2); } #pragma offload_attribute(pop) }; int main () { Rectangle * ppoly1 = new Rectangle(); Triangle * ppoly2 = new Triangle(); Polygon * ppoly3 = new Polygon(); cout &amp;lt;&amp;lt; ppoly1-&amp;gt;area_wrapper(4, 5) &amp;lt;&amp;lt; '\n'; cout &amp;lt;&amp;lt; ppoly2-&amp;gt;area_wrapper(4, 5) &amp;lt;&amp;lt; '\n'; cout &amp;lt;&amp;lt; ppoly3-&amp;gt;area_wrapper(4, 5) &amp;lt;&amp;lt; '\n'; return 0; } When I compile and run it, it results in: $ icpc polygon.cpp $./a.out offload error: process on the device 0 was terminated by signal 11 (SIGSEGV) Thanks in advance, Sanchit&lt;/IOSTREAM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 21:09:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955526#M20690</guid>
      <dc:creator>Sanchit_Misra</dc:creator>
      <dc:date>2014-03-20T21:09:11Z</dc:date>
    </item>
    <item>
      <title>I believe this may require</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955527#M20691</link>
      <description>&lt;P&gt;I believe this may require using &lt;STRONG&gt;&lt;EM&gt;_Cilk_shared/_Cilk_offload&lt;/EM&gt;&lt;/STRONG&gt;. Let me inquire with others more knowledgeable.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2014 08:49:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955527#M20691</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-03-24T08:49:36Z</dc:date>
    </item>
    <item>
      <title>Our C++ Developer confirmed</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955528#M20692</link>
      <description>&lt;P&gt;Our C++ Developer confirmed offloading virtual functions requires using &lt;STRONG&gt;&lt;EM&gt;_Cilk_shared/_Cilk_for &lt;/EM&gt;&lt;/STRONG&gt;and provided the modified version of your program shown below. The output of the modified program is:&lt;/P&gt;

&lt;P&gt;$ icpc t_new.cpp&lt;BR /&gt;
	$ ./a.out&lt;BR /&gt;
	20&lt;BR /&gt;
	10&lt;BR /&gt;
	0&lt;/P&gt;

&lt;P&gt;t_new.cpp&lt;BR /&gt;
	==========&lt;BR /&gt;
	#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;
	#include &amp;lt;offload.h&amp;gt;&lt;/P&gt;

&lt;P&gt;using namespace std;&lt;/P&gt;

&lt;P&gt;#pragma offload_attribute(push, _Cilk_shared)&lt;BR /&gt;
	class Polygon {&lt;BR /&gt;
	public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; virtual int area (int width, int height)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; }&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; int area_wrapper (int width, int height)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int c;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c = _Cilk_offload this-&amp;gt;area(width, height);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return c;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;
	};&lt;BR /&gt;
	#pragma offload_attribute(pop)&lt;/P&gt;

&lt;P&gt;#pragma offload_attribute(push, _Cilk_shared)&lt;BR /&gt;
	class Rectangle: public Polygon&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; int area (int width, int height)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return width * height;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;
	};&lt;BR /&gt;
	#pragma offload_attribute(pop)&lt;/P&gt;

&lt;P&gt;#pragma offload_attribute(push, _Cilk_shared)&lt;BR /&gt;
	class Triangle: public Polygon&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; public:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; int area (int width, int height)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (width * height / 2);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;
	};&lt;BR /&gt;
	#pragma offload_attribute(pop)&lt;/P&gt;

&lt;P&gt;int main ()&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; Rectangle * ppoly1 = new (_Offload_shared_malloc(sizeof(Rectangle))) Rectangle();&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; Triangle * ppoly2 = new (_Offload_shared_malloc(sizeof(Triangle))) Triangle();&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; Polygon * ppoly3 = new (_Offload_shared_malloc(sizeof(Polygon))) Polygon();&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; ppoly1-&amp;gt;area_wrapper(4, 5) &amp;lt;&amp;lt; '\n';&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; ppoly2-&amp;gt;area_wrapper(4, 5) &amp;lt;&amp;lt; '\n';&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; ppoly3-&amp;gt;area_wrapper(4, 5) &amp;lt;&amp;lt; '\n';&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;
	}&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2014 15:54:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955528#M20692</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-03-24T15:54:11Z</dc:date>
    </item>
    <item>
      <title>Thanks Kevin!</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955529#M20693</link>
      <description>&lt;P&gt;Thanks Kevin!&lt;/P&gt;

&lt;P&gt;Will it hurt the performance to have a class instance in virtual shared memory between CPU and MIC using _Offload_shared_malloc(); especially if that class instance is accessed in critical section?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;--Sanchit&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2014 09:28:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955529#M20693</guid>
      <dc:creator>Sanchit_Misra</dc:creator>
      <dc:date>2014-03-27T09:28:20Z</dc:date>
    </item>
    <item>
      <title>Hi Sanchit - Sorry, we are</title>
      <link>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955530#M20694</link>
      <description>&lt;P&gt;Hi Sanchit - Sorry, we are not clear about your question.&lt;/P&gt;

&lt;P&gt;Does "critical section" mean a section of code critical to the code's performance? Or a code section guarded in some fashion for critical or exclusive access?&lt;/P&gt;

&lt;P&gt;Or are you asking whether shared memory access is dramatically slower than non-shared memory and will having class objects in shared memory whose access is critical to the code's performance hurt overall performance?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2014 17:52:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Offloading-virtual-functions/m-p/955530#M20694</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-03-27T17:52:24Z</dc:date>
    </item>
  </channel>
</rss>

