<?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 Yes, it solves the problem, in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186090#M6860</link>
    <description>Yes, it solves the problem, thank you</description>
    <pubDate>Wed, 17 Jun 2020 20:23:38 GMT</pubDate>
    <dc:creator>Sylvain</dc:creator>
    <dc:date>2020-06-17T20:23:38Z</dc:date>
    <item>
      <title>OpenMP target data to intel GPU segmentation fault when array too large</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186086#M6856</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;When testing offload computation to intel GPU with OpenMP, I obtain a segmentation fault at execution with this code :&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;int main()
{
    const int N=350000;

    double a&lt;N&gt;;
    double b&lt;N&gt;;
    double c&lt;N&gt;;
//    double *a = new double&lt;N&gt;;
//    double *b = new double&lt;N&gt;;
//    double *c = new double&lt;N&gt;;

    for (int i=0; i&amp;lt;N; i++) {
        a&lt;I&gt; = i;
        b&lt;I&gt; = 1./i;
    }

    #pragma omp target data map(to:a,b) map(from:c)
//    #pragma omp target data map(to:a[0:N],b[0:N]) map(from:c[0:N])
    {
    #pragma omp target teams distribute parallel for simd
    for (int i=0; i&amp;lt;N; i++) {
        c&lt;I&gt; = a&lt;I&gt;+b&lt;I&gt;;
    }
    }

//    delete[] a;
//    delete[] b;
//    delete[] c;

    return 0;
}
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/N&gt;&lt;/N&gt;&lt;/N&gt;&lt;/N&gt;&lt;/N&gt;&lt;/N&gt;&lt;/PRE&gt;

&lt;P&gt;The error does not happen if I take N=300000 or if I use pointers instead of arrays (use of commented lines). With pointers it works even with N=100000000 (not tested above).&lt;/P&gt;
&lt;P&gt;When looking with gdb, segmentation fault happens at line 12, but I cannot access exact value i, even with -O0.&lt;/P&gt;
&lt;P&gt;My configuration :&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Gentoo Linux&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CPU i5-7300U with HD Graphics 620&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oneAPI HPC Toolkit 2021.1 beta06&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; neo-20.16.16582&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; intel-graphics-compiler-1.0.3826&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; level-zero-0.91.10&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I used "-qnextgen -fiopenmp -fopenmp-targets=spir64" for compilation&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Sylvain&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 11:12:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186086#M6856</guid>
      <dc:creator>Sylvain</dc:creator>
      <dc:date>2020-06-10T11:12:46Z</dc:date>
    </item>
    <item>
      <title>Hi Sylvain,</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186087#M6857</link>
      <description>&lt;P&gt;Hi Sylvain,&lt;/P&gt;&lt;P&gt;We tried the code given by you and it is &lt;STRONG&gt;not giving segfault if I take N=300000.&amp;nbsp;&lt;/STRONG&gt;But we observe segfault if we take N&amp;gt;500000, and it is oblivious as it is&amp;nbsp;exceeding maximum stack size for us. Whereas for the pointer (commented part of your code) it will &lt;STRONG&gt;work without segfault for N=100000000 as it is using heap&lt;/STRONG&gt;&amp;nbsp;instead of the stack.&lt;/P&gt;&lt;P&gt;If you want to check the stack size you can use&amp;nbsp;&lt;STRONG&gt;ulimit -a &lt;/STRONG&gt;command and you will get the reason for segfault.&lt;/P&gt;&lt;P&gt;If you use gdb you will definitely get a segfault on line 12(of your code) but if you try something like below code snippet :&lt;/P&gt;
&lt;PRE class="brush:; class-name:dark;"&gt;    const int N=600000;

    double a&lt;N&gt;;
    double b&lt;N&gt;;
//    double c&lt;N&gt;;

    for (int i=0; i&amp;lt;N; i++) {
        a&lt;I&gt; = i;
        b&lt;I&gt; = 1./i;
    }

    std::cout&amp;lt;&amp;lt;"here\n";
    double c&lt;N&gt;;

&lt;/N&gt;&lt;/I&gt;&lt;/I&gt;&lt;/N&gt;&lt;/N&gt;&lt;/N&gt;&lt;/PRE&gt;

&lt;P&gt;In the above case, we will see that you will get segfault after "std::cout" as stack size is exceeding after std::cout statement.&lt;/P&gt;
&lt;P&gt;So if you have a requirement of large size array then we will recommend you use dynamic memory allocation instead of using stack.&lt;/P&gt;
&lt;P&gt;I hope this helps. Do let us know if your issue is resolved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm Regards,&lt;/P&gt;
&lt;P&gt;Abhishek&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 07:58:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186087#M6857</guid>
      <dc:creator>AbhishekD_Intel</dc:creator>
      <dc:date>2020-06-12T07:58:00Z</dc:date>
    </item>
    <item>
      <title>Thank you for your answer, I</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186088#M6858</link>
      <description>Thank you for your answer, I understand it is a limitation of the system. I am learning new things. Nothing to do with GPU computing and oneAPI HPC Toolkit then.

Best regards,

Sylvain</description>
      <pubDate>Fri, 12 Jun 2020 09:38:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186088#M6858</guid>
      <dc:creator>Sylvain</dc:creator>
      <dc:date>2020-06-12T09:38:49Z</dc:date>
    </item>
    <item>
      <title>Hi Sylvain,</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186089#M6859</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Sylvain,&lt;/P&gt;&lt;P&gt;Please confirm if your issue has been resolved so that we can close the thread.&lt;/P&gt;&lt;P&gt;You can always post a new thread if you face any issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Warm Regards,&lt;/P&gt;&lt;P&gt;Abhishek&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 05:19:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186089#M6859</guid>
      <dc:creator>AbhishekD_Intel</dc:creator>
      <dc:date>2020-06-17T05:19:42Z</dc:date>
    </item>
    <item>
      <title>Yes, it solves the problem,</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186090#M6860</link>
      <description>Yes, it solves the problem, thank you</description>
      <pubDate>Wed, 17 Jun 2020 20:23:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186090#M6860</guid>
      <dc:creator>Sylvain</dc:creator>
      <dc:date>2020-06-17T20:23:38Z</dc:date>
    </item>
    <item>
      <title>Thank you Sylvain for the</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186091#M6861</link>
      <description>&lt;P&gt;Thank you Sylvain for the conformation we are closing this thread.&lt;/P&gt;&lt;P&gt;You can always post&amp;nbsp;a new thread if you face any issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Warm Regards,&lt;/P&gt;&lt;P&gt;Abhishek&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 05:19:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/OpenMP-target-data-to-intel-GPU-segmentation-fault-when-array/m-p/1186091#M6861</guid>
      <dc:creator>AbhishekD_Intel</dc:creator>
      <dc:date>2020-06-18T05:19:28Z</dc:date>
    </item>
  </channel>
</rss>

