<?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 error about a test of asynchronous data transfer in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011678#M34456</link>
    <description>&lt;P&gt;This is my code. I just want to test asynchronous data transfer from CPU to coprocessor. But I got an error message:offload error: "process on the device 0 was terminated by signal 11 (SIGSEGV)"&lt;/P&gt;

&lt;P&gt;Please help me, I have already taken 6 hours to debug this problem.&lt;/P&gt;

&lt;PRE class="brush:cpp;" style="font-size: 13px;"&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string.h&amp;gt;
#define LEN 1024000

void function (float *fPtr0,float*fPtr1,float *fPtr2){

        #pragma offload target(mic:0)wait(1)  nocopy(fPtr0)in(fPtr1:length(LEN)alloc_if(1) free_if(0)) out(fPtr2:length(LEN)alloc_if(1)free_if(0))
{

        for(int i=0;i&amp;lt;11;i++)
                fPtr2&lt;I&gt;=fPtr0&lt;I&gt;+fPtr1&lt;I&gt;;

}
}
int main(){
        float *p0       =       new float [LEN] ;
        float *p1       =       new float [LEN] ;
        float *p2       =       new float [LEN] ;
        memset(p0,0,LEN*sizeof(float));
        #pragma offload_transfer target(mic:0) in(p0:length(LEN) alloc_if(1) free_if(0)) signal(1)
        {}
        for(int i=0;i&amp;lt;LEN;i++)
                p1&lt;I&gt;=i;
        function(p0,p1,p2);
        for(int i=0;i&amp;lt;15;i++)
        std::cout&amp;lt;&amp;lt;p2&lt;I&gt;&amp;lt;&amp;lt;" ";
        std::cout&amp;lt;&amp;lt;std::endl;
        return 0;
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Jul 2014 15:01:58 GMT</pubDate>
    <dc:creator>wang_p_</dc:creator>
    <dc:date>2014-07-28T15:01:58Z</dc:date>
    <item>
      <title>error about a test of asynchronous data transfer</title>
      <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011678#M34456</link>
      <description>&lt;P&gt;This is my code. I just want to test asynchronous data transfer from CPU to coprocessor. But I got an error message:offload error: "process on the device 0 was terminated by signal 11 (SIGSEGV)"&lt;/P&gt;

&lt;P&gt;Please help me, I have already taken 6 hours to debug this problem.&lt;/P&gt;

&lt;PRE class="brush:cpp;" style="font-size: 13px;"&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string.h&amp;gt;
#define LEN 1024000

void function (float *fPtr0,float*fPtr1,float *fPtr2){

        #pragma offload target(mic:0)wait(1)  nocopy(fPtr0)in(fPtr1:length(LEN)alloc_if(1) free_if(0)) out(fPtr2:length(LEN)alloc_if(1)free_if(0))
{

        for(int i=0;i&amp;lt;11;i++)
                fPtr2&lt;I&gt;=fPtr0&lt;I&gt;+fPtr1&lt;I&gt;;

}
}
int main(){
        float *p0       =       new float [LEN] ;
        float *p1       =       new float [LEN] ;
        float *p2       =       new float [LEN] ;
        memset(p0,0,LEN*sizeof(float));
        #pragma offload_transfer target(mic:0) in(p0:length(LEN) alloc_if(1) free_if(0)) signal(1)
        {}
        for(int i=0;i&amp;lt;LEN;i++)
                p1&lt;I&gt;=i;
        function(p0,p1,p2);
        for(int i=0;i&amp;lt;15;i++)
        std::cout&amp;lt;&amp;lt;p2&lt;I&gt;&amp;lt;&amp;lt;" ";
        std::cout&amp;lt;&amp;lt;std::endl;
        return 0;
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jul 2014 15:01:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011678#M34456</guid>
      <dc:creator>wang_p_</dc:creator>
      <dc:date>2014-07-28T15:01:58Z</dc:date>
    </item>
    <item>
      <title>Inside routine function,</title>
      <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011679#M34457</link>
      <description>&lt;P&gt;Inside routine function, change &lt;STRONG&gt;nocopy(fPtr0)&lt;/STRONG&gt; to &lt;STRONG&gt;in(fPtr0 : length(0))&lt;/STRONG&gt; so as to create an instance of the pointer within that routine’s scope and update the pointer’s value only within the associated offload scope and reuse the existing allocation on the coprocessor associated with that pointer. You would only use nocopy within the scope where the pointer was initially created to reuse that instance of it.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2014 21:02:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011679#M34457</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-07-28T21:02:17Z</dc:date>
    </item>
    <item>
      <title>Hi Kevin.</title>
      <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011680#M34458</link>
      <description>&lt;P&gt;Hi Kevin.&lt;/P&gt;

&lt;P&gt;It does work.Thanks very much.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 00:33:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011680#M34458</guid>
      <dc:creator>wang_p_</dc:creator>
      <dc:date>2014-07-29T00:33:19Z</dc:date>
    </item>
    <item>
      <title>There is another problem. </title>
      <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011681#M34459</link>
      <description>&lt;P&gt;There is another problem.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In the pragma offload , we cannot increase the pointer's value.Like this:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string.h&amp;gt;
#include&amp;lt;stdio.h&amp;gt;
#define LEN 1024000

void function (float *fPtr0,float*fPtr1,float *fPtr2){

        #pragma offload target(mic:0)  in(fPtr0:length(0))in(fPtr1:length(LEN)alloc_if(1) free_if(0)) out(fPtr2:length(LEN)alloc_if(1)free_if(0))
{
#if 1

        for(int i=0;i&amp;lt;11;i++){
        //      fPtr2&lt;I&gt;=fPtr0&lt;I&gt;+fPtr1&lt;I&gt;; //It's ok!
                *fPtr2++=*fPtr0++ + *fPtr1++; // error message:offload error: cannot release buffer memory on device 0 (error code 14)
}
#endif

}
}
int main(){
        float *p0       =       new float [LEN] ;
        float *p1       =       new float [LEN] ;
        float *p2       =       new float [LEN] ;
        memset(p0,0,LEN*sizeof(float));
        #pragma offload_transfer target(mic:0) in(p0:length(LEN)alloc_if(1) free_if(0)) signal(1)
        {}
        for(int i=0;i&amp;lt;LEN;i++)
                p1&lt;I&gt;=i;
        #pragma offload_wait target(mic:0) wait(1)
        function(p0,p1,p2);
        function(p0,p1,p2);
        for(int i=0;i&amp;lt;15;i++)
        std::cout&amp;lt;&amp;lt;p2&lt;I&gt;&amp;lt;&amp;lt;" ";
        std::cout&amp;lt;&amp;lt;std::endl;
        return 0;

}
~
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 01:34:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011681#M34459</guid>
      <dc:creator>wang_p_1</dc:creator>
      <dc:date>2014-07-29T01:34:00Z</dc:date>
    </item>
    <item>
      <title>I have already solve above</title>
      <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011682#M34460</link>
      <description>&lt;P&gt;I have already solve above problem.&lt;/P&gt;

&lt;P&gt;I just take the pointer offset to it's original. like this:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string.h&amp;gt;
#include&amp;lt;stdio.h&amp;gt;
#define LEN 1024000

void function (float *fPtr0,float*fPtr1,float *fPtr2){

        #pragma offload target(mic:0)  in(fPtr0:length(0))in(fPtr1:length(LEN)alloc_if(1) free_if(0)) out(fPtr2:length(LEN)alloc_if(1)free_if(0))
{
#if 1

        for(int i=0;i&amp;lt;LEN;i++){
                *fPtr2++=*fPtr0++ + *fPtr1++; 
}
        fPtr0 -= LEN;
        fPtr1 -= LEN;
        fPtr2 -= LEN;
#endif

}
}
int main(){
        float *p0       =       new float [LEN] ;
        float *p1       =       new float [LEN] ;
        float *p2       =       new float [LEN] ;
        memset(p0,0,LEN*sizeof(float));
        #pragma offload_transfer target(mic:0) in(p0:length(LEN)alloc_if(1) free_if(0)) signal(1)
        {}
        for(int i=0;i&amp;lt;LEN;i++)
                p1&lt;I&gt;=i;
        #pragma offload_wait target(mic:0) wait(1)
        function(p0,p1,p2);
        function(p0,p1,p2);
        for(int i=0;i&amp;lt;15;i++)
        std::cout&amp;lt;&amp;lt;p2&lt;I&gt;&amp;lt;&amp;lt;" ";
        std::cout&amp;lt;&amp;lt;std::endl;
        return 0;

}&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 02:12:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011682#M34460</guid>
      <dc:creator>wang_p_1</dc:creator>
      <dc:date>2014-07-29T02:12:00Z</dc:date>
    </item>
    <item>
      <title>Because you want to continue</title>
      <link>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011683#M34461</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New"&gt;Because you want to continue using the memory allocated in the main program&amp;nbsp;for p0,&amp;nbsp;&lt;/FONT&gt;line 8 above should be changed to contain this:&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Courier New"&gt;in(fPtr0:length(0) alloc_if(0) free_if(0) )&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Courier New"&gt;The alloc_if(0) and free_if(0) modifiers are needed because the default for the "in" clause is alloc_if(1) and free_if(1).&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Courier New"&gt;With that change the program works.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 16:53:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/error-about-a-test-of-asynchronous-data-transfer/m-p/1011683#M34461</guid>
      <dc:creator>Rajiv_D_Intel</dc:creator>
      <dc:date>2014-07-29T16:53:36Z</dc:date>
    </item>
  </channel>
</rss>

