<?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 Ravi just beat me to it. The in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055686#M51782</link>
    <description>&lt;P&gt;Ravi just beat me to it. The keys are &lt;STRONG&gt;IN &lt;/STRONG&gt;and&lt;STRONG&gt; length(0) &lt;/STRONG&gt;in the scope of bar(). &lt;STRONG&gt;IN &lt;/STRONG&gt;creates a new instance of the local pointer A within the new scope of bar() and the &lt;STRONG&gt;length(0) &lt;/STRONG&gt;ensures no data transfer. &lt;STRONG&gt;NOCOPY &lt;/STRONG&gt;causes the segV because it assumes an instance of the pointer exists when it does not within the new scope.&lt;/P&gt;

&lt;P&gt;Your offload in bar() also does not specify the target-id were as in foo() you created/transferred A to target-id 0 (i.e. &lt;STRONG&gt;target(mic:0)&lt;/STRONG&gt; ) so be sure bar() also uses the same target-id.&lt;/P&gt;

&lt;P&gt;The &lt;STRONG&gt;offload_transfer&lt;/STRONG&gt; in bar() appears to only wait on the signal. You could perhaps use &lt;STRONG&gt;offload_wait&lt;/STRONG&gt; if there is no associated transfer expected in waiting on that signal.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jan 2015 16:24:00 GMT</pubDate>
    <dc:creator>Kevin_D_Intel</dc:creator>
    <dc:date>2015-01-20T16:24:00Z</dc:date>
    <item>
      <title>Reuse on-device data within a function call</title>
      <link>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055684#M51780</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
	&lt;BR /&gt;
	is it possible to reuse data that is already on the device eventhough there is a function call inbetween.&lt;BR /&gt;
	Here is an example:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void foo(){
   float* A;
   ... initialize A ...

   #pragma offload_transfer target(mic:0) in(A:length(sizeA) alloc_if(1) free_if(0)) signal(1)
   ...some CPU function... //overlap this function with data transfer
   
   bar(A, sizeA);
}

void bar(float* A, int sizeA){
   #pragma offload_transfer target(mic:0) wait(1)

   #pragma offload target(mic) nocopy(A:length(sizeA) alloc_if(0) free_if(0))
   deviceFunction(A,sizeA);
}&lt;/PRE&gt;

&lt;P&gt;A similar program like this segfaults, because A is not known to the device within bar(). The solution that I've found so far would be to make *A a global variable, but this isn't really practical. I also tried to use pointers to pointers but that didn't work somehow.&lt;/P&gt;

&lt;P&gt;Does someone know a solution to this problem?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 15:00:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055684#M51780</guid>
      <dc:creator>Paul_S_</dc:creator>
      <dc:date>2015-01-20T15:00:34Z</dc:date>
    </item>
    <item>
      <title>Change</title>
      <link>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055685#M51781</link>
      <description>&lt;P&gt;&lt;FONT color="#808080"&gt;Change&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#808080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma offload target(mic) nocopy(A:length(sizeA) alloc_if(0) free_if(0))&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#808080"&gt;to&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#808080"&gt;#pragma offload target(mic) in(A:length(0) alloc_if(0) free_if(0))&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 16:08:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055685#M51781</guid>
      <dc:creator>Ravi_N_Intel</dc:creator>
      <dc:date>2015-01-20T16:08:11Z</dc:date>
    </item>
    <item>
      <title>Ravi just beat me to it. The</title>
      <link>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055686#M51782</link>
      <description>&lt;P&gt;Ravi just beat me to it. The keys are &lt;STRONG&gt;IN &lt;/STRONG&gt;and&lt;STRONG&gt; length(0) &lt;/STRONG&gt;in the scope of bar(). &lt;STRONG&gt;IN &lt;/STRONG&gt;creates a new instance of the local pointer A within the new scope of bar() and the &lt;STRONG&gt;length(0) &lt;/STRONG&gt;ensures no data transfer. &lt;STRONG&gt;NOCOPY &lt;/STRONG&gt;causes the segV because it assumes an instance of the pointer exists when it does not within the new scope.&lt;/P&gt;

&lt;P&gt;Your offload in bar() also does not specify the target-id were as in foo() you created/transferred A to target-id 0 (i.e. &lt;STRONG&gt;target(mic:0)&lt;/STRONG&gt; ) so be sure bar() also uses the same target-id.&lt;/P&gt;

&lt;P&gt;The &lt;STRONG&gt;offload_transfer&lt;/STRONG&gt; in bar() appears to only wait on the signal. You could perhaps use &lt;STRONG&gt;offload_wait&lt;/STRONG&gt; if there is no associated transfer expected in waiting on that signal.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 16:24:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055686#M51782</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2015-01-20T16:24:00Z</dc:date>
    </item>
    <item>
      <title>perfect! Thanks, that helped.</title>
      <link>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055687#M51783</link>
      <description>&lt;P&gt;perfect! Thanks, that helped.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2015 08:03:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055687#M51783</guid>
      <dc:creator>Paul_S_</dc:creator>
      <dc:date>2015-01-21T08:03:23Z</dc:date>
    </item>
    <item>
      <title>Your welcome. Glad to hear</title>
      <link>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055688#M51784</link>
      <description>&lt;P&gt;Your welcome. Glad to hear that.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2015 10:58:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reuse-on-device-data-within-a-function-call/m-p/1055688#M51784</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2015-01-21T10:58:45Z</dc:date>
    </item>
  </channel>
</rss>

