<?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 Perhaps Explicitly managed in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980438#M25960</link>
    <description>&lt;P&gt;Perhaps &lt;STRONG&gt;Explicitly managed Heap-allocated Data&lt;/STRONG&gt; discussed &lt;A href="http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features"&gt;here&lt;/A&gt; provides the functionality you’re looking for.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2013 07:59:00 GMT</pubDate>
    <dc:creator>Kevin_D_Intel</dc:creator>
    <dc:date>2013-06-05T07:59:00Z</dc:date>
    <item>
      <title>How to malloc a buffer on co-processor in offload mode?</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980436#M25958</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;How could I malloc a buffer on co-processor in offload mode? I only know that I can malloc a buffer on host, and use "offload in" to malloc the same buffer on co-processor. Is there some ways that I can malloc the buffer on co-processor directly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Thanks a lot!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 00:17:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980436#M25958</guid>
      <dc:creator>songlinhai</dc:creator>
      <dc:date>2013-06-05T00:17:57Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980437#M25959</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can use malloc directly inside the offload region!&lt;/P&gt;
&lt;P&gt;if you want to use the buffer later on, you can use an output variable in the (size_t) and use it later as in variable for aother offload region.&lt;/P&gt;
&lt;P&gt;you should do the cast!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 07:56:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980437#M25959</guid>
      <dc:creator>Bachar_Z_</dc:creator>
      <dc:date>2013-06-05T07:56:49Z</dc:date>
    </item>
    <item>
      <title>Perhaps Explicitly managed</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980438#M25960</link>
      <description>&lt;P&gt;Perhaps &lt;STRONG&gt;Explicitly managed Heap-allocated Data&lt;/STRONG&gt; discussed &lt;A href="http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features"&gt;here&lt;/A&gt; provides the functionality you’re looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 07:59:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980438#M25960</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2013-06-05T07:59:00Z</dc:date>
    </item>
    <item>
      <title>Quote:Kevin Davis (Intel)</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980439#M25961</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Kevin Davis (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Perhaps &lt;STRONG&gt;Explicitly managed Heap-allocated Data&lt;/STRONG&gt; discussed &lt;A href="http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features"&gt;here&lt;/A&gt; provides the functionality you’re looking for.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if we want to use the pointer p in more than one function, this way does not work!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 08:33:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980439#M25961</guid>
      <dc:creator>Bachar_Z_</dc:creator>
      <dc:date>2013-06-05T08:33:29Z</dc:date>
    </item>
    <item>
      <title>That is correct; however,</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980440#M25962</link>
      <description>&lt;P&gt;With the local pointer that is&amp;nbsp;correct; however, with a global pointer as demonstrated below the method is usable with multiple functions. I also confirmed this with our Developers.&lt;/P&gt;
&lt;P&gt;$ icc -V&lt;/P&gt;
&lt;P&gt;Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.1.2.183 Build 20130514&lt;/P&gt;
&lt;P&gt;$ icc example.c -o example &amp;amp;&amp;amp; example&lt;/P&gt;
&lt;P&gt;q = 77&lt;/P&gt;
&lt;P&gt;[cpp]#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;
&lt;P&gt;#include &amp;lt;offload.h&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;__attribute__ ((target (mic))) int *p;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;extern void f1();&lt;/P&gt;
&lt;P&gt;extern void f2();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;void f1()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // The nocopy clause ensures CPU values pointed to by p&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // are not transferred to coprocessor&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pragma offload target(mic:0) nocopy(p)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Allocate dynamic memory for p on coprocessor&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = (int *)malloc(sizeof (int) * 100);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p[99] = 77;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;void f2()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;int q = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // The nocopy clause ensures p is not altered by the offload process&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pragma offload target(mic:0) nocopy(p) out(q)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reuse dynamic memory pointed to by p&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; q = p[99]; // Will be 77&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; printf("q = %d\n",q);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;int main()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;f1();&lt;/P&gt;
&lt;P&gt;f2();&lt;/P&gt;
&lt;P&gt;}[/cpp]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2013 15:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980440#M25962</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2013-06-06T15:18:00Z</dc:date>
    </item>
    <item>
      <title>My case was the following:</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980441#M25963</link>
      <description>&lt;P&gt;My case was the following:&lt;/P&gt;
&lt;P&gt;I have an object with a pointer sould be in Phi mem, and I use that object in may functionality inside the system.&lt;/P&gt;
&lt;P&gt;in my case, the global array( pointer) does not work because I have many of this object. " static does have the same problem"&lt;/P&gt;
&lt;P&gt;And then I used the size_t variable as output for the alloc part ofthe object and I can use that value whenever I need to apply some functionality to any obect of that type!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2013 09:16:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980441#M25963</guid>
      <dc:creator>Bachar_Z_</dc:creator>
      <dc:date>2013-06-07T09:16:59Z</dc:date>
    </item>
    <item>
      <title>With reference to Kevin's</title>
      <link>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980442#M25964</link>
      <description>&lt;P&gt;With reference to Kevin's code example above using nopy to reference a buffer that is created on the Mics. This method currently has a problem when using multiple Mics, though works fine for a single device. Read here for further discussion on that specific method:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://software.intel.com/en-us/forums/topic/393649"&gt;http://software.intel.com/en-us/forums/topic/393649&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Corey&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2013 02:17:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/How-to-malloc-a-buffer-on-co-processor-in-offload-mode/m-p/980442#M25964</guid>
      <dc:creator>Corey_P_</dc:creator>
      <dc:date>2013-06-18T02:17:39Z</dc:date>
    </item>
  </channel>
</rss>

