<?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: Mini-app with random123 library : Runtime Error in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415604#M2530</link>
    <description>&lt;P&gt;Hi Christos,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for posting in Intel Communities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try using the LLVM based compilers(icx,icpx,dpcpp) as only these compilers support the OpenMP Offload feature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have tried your code with icpx and dpcpp compiler for both the codes(mini_workaround.cpp and mini.cpp), we are able to compile and run the code without any errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more details, please find the below screenshots:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="offload_mini.png" style="width: 574px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33434i7E82B852E79449D3/image-dimensions/574x112?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="574" height="112" role="button" title="offload_mini.png" alt="offload_mini.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="offload_miniwork.png" style="width: 577px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33435i76764C5C81A569D2/image-dimensions/577x111?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="577" height="111" role="button" title="offload_miniwork.png" alt="offload_miniwork.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Varsha&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 11:23:52 GMT</pubDate>
    <dc:creator>VarshaS_Intel</dc:creator>
    <dc:date>2022-09-19T11:23:52Z</dc:date>
    <item>
      <title>Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415198#M2525</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;We are using &lt;A href="https://github.com/DEShawResearch/random123" target="_self"&gt;Random123 library&lt;/A&gt;&amp;nbsp;to generate random numbers for our solvers. In this self-contained mini-app (see attached folder) that I am trying in the devcloud, while I am able to compile it, there is a runtime error. For your information I have compiled and executed this mini-app with NVIDIA compilers and I had no runtime issues (after applying a small workaround).&lt;/P&gt;
&lt;P&gt;In the attached mini-app, there is everything that you need in order to compile and run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A description of the mini-app:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;This mini-app shows a small example of the use of OpenMP offloading with random123 in the context of the CoreNEURON application.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;We have removed most of the unnecessary code and simplified the handling of the random number generator, but kept the essential bits.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;In order to build the example codes here, you need to first clone random123 inside this directory:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;git clone &lt;A href="https://github.com/DEShawResearch/random123.git" target="_blank" rel="noopener"&gt;https://github.com/DEShawResearch/random123.git&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV&gt;&lt;SPAN&gt;A rough breakdown of the code:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt; The main driver code is in &lt;/SPAN&gt;&lt;SPAN&gt;`main.cpp`&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt; &lt;SPAN&gt;`mini.hpp`&lt;/SPAN&gt;&lt;SPAN&gt; contains struct and function declarations used in the driver and the test codes.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt; &lt;SPAN&gt;`mini.cpp`&lt;/SPAN&gt;&lt;SPAN&gt; this is the test code that currently fails with nvhpc. The issue is described in detail also here: &lt;A href="https://forums.developer.nvidia.com/t/implicit-omp-declare-target-for-functions-outside-namespace-not-accepted-by-nvc/198582" target="_blank" rel="noopener"&gt;https://forums.developer.nvidia.com/t/implicit-omp-declare-target-for-functions-outside-namespace-not-accepted-by-nvc/198582&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt; &lt;SPAN&gt;`mini_workaround.cpp`&lt;/SPAN&gt;&lt;SPAN&gt; this code implements the workaround we found that requires adding a helper function, which compiles and runs correctly.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any feedback on why we cannot make it run with Intel-oneAPI would be really appreciated.&lt;/P&gt;
&lt;P&gt;Thank you very much in advance.&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Christos&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 12:11:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415198#M2525</guid>
      <dc:creator>Christos_Kotsalos</dc:creator>
      <dc:date>2022-09-16T12:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415604#M2530</link>
      <description>&lt;P&gt;Hi Christos,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for posting in Intel Communities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try using the LLVM based compilers(icx,icpx,dpcpp) as only these compilers support the OpenMP Offload feature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have tried your code with icpx and dpcpp compiler for both the codes(mini_workaround.cpp and mini.cpp), we are able to compile and run the code without any errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more details, please find the below screenshots:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="offload_mini.png" style="width: 574px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33434i7E82B852E79449D3/image-dimensions/574x112?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="574" height="112" role="button" title="offload_mini.png" alt="offload_mini.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="offload_miniwork.png" style="width: 577px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33435i76764C5C81A569D2/image-dimensions/577x111?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="577" height="111" role="button" title="offload_miniwork.png" alt="offload_miniwork.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Varsha&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 11:23:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415604#M2530</guid>
      <dc:creator>VarshaS_Intel</dc:creator>
      <dc:date>2022-09-19T11:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415860#M2537</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Varsha,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you very much for your response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have fixed my Makefile to use the compilers that you told me but I still have the same issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The steps that I follow (connected to the devcloud) are the following:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. In the nrn123 folder -&amp;gt;&amp;nbsp;qsub -I -l nodes=1:gpu:ppn=2 -d .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;qsub: waiting for job 1989259.v-qsvr-1.aidevcloud to start&lt;BR /&gt;qsub: job 1989259.v-qsvr-1.aidevcloud ready########################################################################&lt;BR /&gt;# Date: Mon 19 Sep 2022 11:33:33 PM PDT&lt;BR /&gt;# Job ID: 1989259.v-qsvr-1.aidevcloud&lt;BR /&gt;# User: u149321&lt;BR /&gt;# Resources: neednodes=1:gpu:ppn=2,nodes=1:gpu:ppn=2,walltime=06:00:00&lt;BR /&gt;########################################################################&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.&amp;nbsp;export OMP_TARGET_OFFLOAD=MANDATORY&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. make mini_intel_icpx -&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;icpx -O2 -g -qopenmp -fopenmp-targets=spir64 -Irandom123/include -DR123_USE_INTRIN_H=0 mini.cpp main.cpp -c&lt;BR /&gt;icpx -O2 -g -qopenmp -fopenmp-targets=spir64 -Irandom123/include -DR123_USE_INTRIN_H=0 mini.o main.o -o out&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4. ./out -&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Libomptarget error: Unable to generate entries table for device id 0.&lt;BR /&gt;Libomptarget error: Failed to init globals on device 0&lt;BR /&gt;Libomptarget error: Run with&lt;BR /&gt;Libomptarget error: LIBOMPTARGET_DEBUG=1 to display basic debug information.&lt;BR /&gt;Libomptarget error: LIBOMPTARGET_DEBUG=2 to display calls to the compute runtime.&lt;BR /&gt;Libomptarget error: LIBOMPTARGET_INFO=4 to dump host-target pointer mappings.&lt;BR /&gt;unknown:16:16: Libomptarget fatal error 1: failure of target construct while offloading is mandatory&lt;BR /&gt;Aborted&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5.&amp;nbsp;LIBOMPTARGET_DEBUG=1 ./out -&amp;gt; see attached error file&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have re-attached the code with the updated Makefile.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Am I missing something?&lt;/P&gt;
&lt;P&gt;Thank you very much for your time!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 06:38:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1415860#M2537</guid>
      <dc:creator>Christos_Kotsalos</dc:creator>
      <dc:date>2022-09-20T06:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1416223#M2546</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for providing the information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At our end, we are able to run&amp;nbsp;successfully without any errors. Please find the below screenshot:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="after_workaround.png" style="width: 727px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/33499i446AAEE9656D111A/image-dimensions/727x155?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="727" height="155" role="button" title="after_workaround.png" alt="after_workaround.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please let us know the node details you are using in Intel DevCloud? And also, please provide the output for "sycl-ls".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Varsha&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 11:52:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1416223#M2546</guid>
      <dc:creator>VarshaS_Intel</dc:creator>
      <dc:date>2022-09-21T11:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1416226#M2547</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Varsha,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Actually I just tried the steps that I posted in my previous comment and I could compile &amp;amp; run my mini-app without any issue. It is weird because yesterday following the exact same steps in the dev cloud I was getting the error that I posted previously.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;FYI, I typed&amp;nbsp;sycl-ls and I got the following:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]&lt;BR /&gt;[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Xeon(R) E-2176G CPU @ 3.70GHz 3.0 [2022.13.3.0.16_160000]&lt;BR /&gt;[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) UHD Graphics P630 [0x3e96] 3.0 [22.10.22597]&lt;BR /&gt;[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) UHD Graphics P630 [0x3e96] 1.3 [1.3.22597]&lt;BR /&gt;[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Therefore, your earlier comment about the right compilers resolved my issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you very much for helping me figuring it out.&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>Wed, 21 Sep 2022 12:00:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1416226#M2547</guid>
      <dc:creator>Christos_Kotsalos</dc:creator>
      <dc:date>2022-09-21T12:00:30Z</dc:date>
    </item>
    <item>
      <title>Re:Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1416571#M2550</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&lt;EM&gt;Therefore, your earlier comment about the right compilers resolved my issue.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Glad to know that your issue is resolved. &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;Varsha&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Sep 2022 13:41:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1416571#M2550</guid>
      <dc:creator>VarshaS_Intel</dc:creator>
      <dc:date>2022-09-22T13:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Mini-app with random123 library : Runtime Error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1472984#M2960</link>
      <description>&lt;P&gt;Hello Christos,&lt;/P&gt;
&lt;P&gt;Thank you for providing the details and the mini-app. Based on the error message you provided in the attached file, it seems like there is an issue with the offload code generated by Intel-oneAPI compiler for the &lt;CODE&gt;mini.cpp&lt;/CODE&gt; file. Specifically, the error message mentions that "implicit omp declare target for functions outside namespace not accepted by nvc".&lt;/P&gt;
&lt;P&gt;This error message is related to the way Intel-oneAPI compiler handles offload code with OpenMP directives. One potential workaround is to modify the &lt;CODE&gt;mini.cpp&lt;/CODE&gt; file by adding a helper function as you did for the NVIDIA compiler. Another potential workaround is to use a different compiler option for offload code generation. You can try adding the &lt;CODE&gt;-qopenmp-offload=nvptx&lt;/CODE&gt; option to the &lt;CODE&gt;CXXFLAGS&lt;/CODE&gt; variable in the Makefile to see if it resolves the issue.&lt;/P&gt;
&lt;P&gt;I hope this helps. Let me know if you have any further questions or concerns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 11:20:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Mini-app-with-random123-library-Runtime-Error/m-p/1472984#M2960</guid>
      <dc:creator>Jason21</dc:creator>
      <dc:date>2023-04-04T11:20:29Z</dc:date>
    </item>
  </channel>
</rss>

