<?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 Re: OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415614#M2532</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the code snippet you have shared with us we have observed that the pointer you are passing is not a valid device pointer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please try with the below-changed code snippet and let us know if you further face any issues?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;omp.h&amp;gt;
int main() {
 double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(omp_target_alloc(size, 0)); 
 printf("ptr=%p\n", ptr);
 #pragma omp target parallel for simd is_device_ptr(ptr) if(true)
 for(int i = 0; i &amp;lt; 1; ++i) {
  printf("ptr=%p\n", ptr);
 }
 #pragma omp target parallel for simd if(true) is_device_ptr(ptr)
 for(int i = 0; i &amp;lt; 1; ++i) {
 printf("ptr=%p\n", ptr);
 }
 return 100;
} &lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Replace:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(omp_target_alloc(size, 0));&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;instead of:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(0xdeadbeef);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;
&lt;P&gt;Shivani&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 12:20:39 GMT</pubDate>
    <dc:creator>ShivaniK_Intel</dc:creator>
    <dc:date>2022-09-19T12:20:39Z</dc:date>
    <item>
      <title>OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1414136#M2498</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have this very simple example:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;stdio.h&amp;gt;

int main() {
  double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(0xdeadbeef);
  printf("ptr=%p\n", ptr);
  #pragma omp target parallel for simd is_device_ptr(ptr) if(true)
  for(int i = 0; i &amp;lt; 1; ++i) {
    printf("ptr=%p\n", ptr);
  }
  #pragma omp target parallel for simd if(true) is_device_ptr(ptr)
  for(int i = 0; i &amp;lt; 1; ++i) {
    printf("ptr=%p\n", ptr);
  }
  return 100;
}&lt;/LI-CODE&gt;
&lt;P&gt;For which I follow these steps in Intel DevCloud:&lt;/P&gt;
&lt;DIV&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;qsub -I -l nodes=1:gpu:ppn=2 -d .&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;icpx -qopenmp -fopenmp-targets=spir64 openmp_target_offload_clause_ordering.cpp&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;export OMP_TARGET_OFFLOAD=MANDATORY&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;./a.out&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;and while it compiles it fails in runtime.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I have tested it with NVIDIA compilers (v&lt;SPAN&gt;22.2&lt;/SPAN&gt;) and I had no issue (before the v&lt;SPAN&gt;22.2 there was an issue with the clause ordering -between if and is_device_ptr- but it was a confirmed bug&lt;/SPAN&gt;).&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I would really apreciate any feedback.&lt;/DIV&gt;
&lt;DIV&gt;Thank you very much&lt;/DIV&gt;
&lt;DIV&gt;Best,&lt;/DIV&gt;
&lt;DIV&gt;Christos&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 12 Sep 2022 09:28:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1414136#M2498</guid>
      <dc:creator>Christos_Kotsalos</dc:creator>
      <dc:date>2022-09-12T09:28:00Z</dc:date>
    </item>
    <item>
      <title>Re:OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1414941#M2515</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting in the Intel forums&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We are able to reproduce the issue at our end by following the steps you have provided. We are working on it and will get back to you.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Shivani&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Sep 2022 10:40:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1414941#M2515</guid>
      <dc:creator>ShivaniK_Intel</dc:creator>
      <dc:date>2022-09-15T10:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415181#M2522</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Shivani&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you very much for your quick response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am looking forward to hearing from you regarding this compiler issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Christos&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 07:00:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415181#M2522</guid>
      <dc:creator>Christos_Kotsalos</dc:creator>
      <dc:date>2022-09-16T07:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415614#M2532</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the code snippet you have shared with us we have observed that the pointer you are passing is not a valid device pointer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please try with the below-changed code snippet and let us know if you further face any issues?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;omp.h&amp;gt;
int main() {
 double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(omp_target_alloc(size, 0)); 
 printf("ptr=%p\n", ptr);
 #pragma omp target parallel for simd is_device_ptr(ptr) if(true)
 for(int i = 0; i &amp;lt; 1; ++i) {
  printf("ptr=%p\n", ptr);
 }
 #pragma omp target parallel for simd if(true) is_device_ptr(ptr)
 for(int i = 0; i &amp;lt; 1; ++i) {
 printf("ptr=%p\n", ptr);
 }
 return 100;
} &lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Replace:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(omp_target_alloc(size, 0));&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;instead of:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;double *ptr = reinterpret_cast&amp;lt;double*&amp;gt;(0xdeadbeef);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;
&lt;P&gt;Shivani&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:20:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415614#M2532</guid>
      <dc:creator>ShivaniK_Intel</dc:creator>
      <dc:date>2022-09-19T12:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415868#M2538</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Shivani,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you very much for your prompt response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Indeed, after your suggestion the code works without any issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks for resolving it!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Christos&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 07:05:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415868#M2538</guid>
      <dc:creator>Christos_Kotsalos</dc:creator>
      <dc:date>2022-09-20T07:05:43Z</dc:date>
    </item>
    <item>
      <title>Re:OpenMP clause ordering (GPU offload) and is_device_ptr strange behavior</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415892#M2539</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Shivani&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Sep 2022 09:07:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/OpenMP-clause-ordering-GPU-offload-and-is-device-ptr-strange/m-p/1415892#M2539</guid>
      <dc:creator>ShivaniK_Intel</dc:creator>
      <dc:date>2022-09-20T09:07:49Z</dc:date>
    </item>
  </channel>
</rss>

