<?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 using multiple malloc_device() cause error in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1402982#M2385</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;N is 512 * 32768&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="cpp"&gt;double *data_device = malloc_device&amp;lt;double&amp;gt;(N * 7, q); q.wait();&lt;/LI-CODE&gt;
&lt;P&gt;when using malloc_device(), if we malloc space larger than N * 7, it would cause error&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;terminate called after throwing an instance of 'cl::sycl::runtime_error'
  what():  Native API failed. Native API returns: -5 (CL_OUT_OF_RESOURCES) -5 (CL_OUT_OF_RESOURCES)
Aborted (core dumped)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;our device is Intel ATS-P 2Tail GPU with oneAPI&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dpcpp --version
Intel(R) oneAPI DPC++/C++ Compiler 2022.1.0 (2022.1.0.20220316)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2022.1.0/linux/bin-llvm&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the source code is simplized as :&lt;/P&gt;
&lt;P&gt;if there is no parallel for, it would not cause error&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;
#include &amp;lt;vector&amp;gt;
using namespace sycl;
using namespace std;

static const int N = 512 * 32768;

int main() {
  queue q;
  std::cout &amp;lt;&amp;lt; "Device : " &amp;lt;&amp;lt; q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; "\n";

  //# initialize data on host
  double *data = static_cast&amp;lt;double *&amp;gt;(malloc(N * sizeof(double)));
  for (int i = 0; i &amp;lt; N; i++) data[i] = i;

  //# Explicit USM allocation using malloc_device
  double *data_device = malloc_device&amp;lt;double&amp;gt;(N * 8, q); q.wait();


  //# update device memory
  q.parallel_for(range&amp;lt;1&amp;gt;(N), [=](id&amp;lt;1&amp;gt; i) { data_device[i] = 2.0; }).wait();

  //# copy mem from device to host
  // q.memcpy(data, data_device, sizeof(double) * N).wait();

  //# print output
  // for (int i = 0; i &amp;lt; N; i++) std::cout &amp;lt;&amp;lt; data[i] &amp;lt;&amp;lt; "\n";
  free(data_device, q);
  free(data);
  return 0;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 25 Jul 2022 06:26:53 GMT</pubDate>
    <dc:creator>llll</dc:creator>
    <dc:date>2022-07-25T06:26:53Z</dc:date>
    <item>
      <title>using multiple malloc_device() cause error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1402982#M2385</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;N is 512 * 32768&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="cpp"&gt;double *data_device = malloc_device&amp;lt;double&amp;gt;(N * 7, q); q.wait();&lt;/LI-CODE&gt;
&lt;P&gt;when using malloc_device(), if we malloc space larger than N * 7, it would cause error&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;terminate called after throwing an instance of 'cl::sycl::runtime_error'
  what():  Native API failed. Native API returns: -5 (CL_OUT_OF_RESOURCES) -5 (CL_OUT_OF_RESOURCES)
Aborted (core dumped)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;our device is Intel ATS-P 2Tail GPU with oneAPI&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dpcpp --version
Intel(R) oneAPI DPC++/C++ Compiler 2022.1.0 (2022.1.0.20220316)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2022.1.0/linux/bin-llvm&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the source code is simplized as :&lt;/P&gt;
&lt;P&gt;if there is no parallel for, it would not cause error&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;
#include &amp;lt;vector&amp;gt;
using namespace sycl;
using namespace std;

static const int N = 512 * 32768;

int main() {
  queue q;
  std::cout &amp;lt;&amp;lt; "Device : " &amp;lt;&amp;lt; q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; "\n";

  //# initialize data on host
  double *data = static_cast&amp;lt;double *&amp;gt;(malloc(N * sizeof(double)));
  for (int i = 0; i &amp;lt; N; i++) data[i] = i;

  //# Explicit USM allocation using malloc_device
  double *data_device = malloc_device&amp;lt;double&amp;gt;(N * 8, q); q.wait();


  //# update device memory
  q.parallel_for(range&amp;lt;1&amp;gt;(N), [=](id&amp;lt;1&amp;gt; i) { data_device[i] = 2.0; }).wait();

  //# copy mem from device to host
  // q.memcpy(data, data_device, sizeof(double) * N).wait();

  //# print output
  // for (int i = 0; i &amp;lt; N; i++) std::cout &amp;lt;&amp;lt; data[i] &amp;lt;&amp;lt; "\n";
  free(data_device, q);
  free(data);
  return 0;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Jul 2022 06:26:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1402982#M2385</guid>
      <dc:creator>llll</dc:creator>
      <dc:date>2022-07-25T06:26:53Z</dc:date>
    </item>
    <item>
      <title>Re:using multiple malloc_device() cause error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1403440#M2390</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;&lt;P&gt;We are working on your issue. We will get back to you soon.&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;Noorjahan.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jul 2022 09:43:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1403440#M2390</guid>
      <dc:creator>NoorjahanSk_Intel</dc:creator>
      <dc:date>2022-07-26T09:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: using multiple malloc_device() cause error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1404121#M2397</link>
      <description>&lt;P&gt;I cannot reproduce your issue on my side. However, according to SYCL spec 2020, there's a relationship between how much memory can be allocated during a single allocation and the global_mem_size:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;info::device:: max_mem_alloc_size returns the maximum size of memory object allocation in bytes. The minimum value is max (1/4th of info::device::global_mem_size ,128*1024*1024) if this SYCL device is not of device type info::device_type::custom.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://registry.khronos.org/SYCL/specs/sycl-2020-provisional.pdf" target="_blank" rel="noopener"&gt;https://registry.khronos.org/SYCL/specs/sycl-2020-provisional.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I also know your machine information and GPU driver version?&amp;nbsp;&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>Sat, 30 Jul 2022 08:53:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1404121#M2397</guid>
      <dc:creator>Alex_Y_Intel</dc:creator>
      <dc:date>2022-07-30T08:53:53Z</dc:date>
    </item>
    <item>
      <title>Re:using multiple malloc_device() cause error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1407208#M2424</link>
      <description>&lt;P&gt;Since there's no further update, I'm closing this issue from our site, but please feel free to discuss the issue with other people in the forum, or open another new topic if necessary. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Aug 2022 21:32:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1407208#M2424</guid>
      <dc:creator>Alex_Y_Intel</dc:creator>
      <dc:date>2022-08-09T21:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: using multiple malloc_device() cause error</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1407375#M2427</link>
      <description>&lt;P&gt;sorry for replying late, It is a competition platform and ther are few information about it. But I could provide `sycl-ls` info.&lt;/P&gt;
&lt;P&gt;As I know, It's xe_hp_sdv GPU.&lt;/P&gt;
&lt;LI-CODE lang="bash"&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]
[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Xeon(R) Gold 6326 CPU @ 2.90GHz 3.0 [2022.13.3.0.16_160000]
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) Graphics [0x020a] 3.0 [22.18.023111]
[opencl:gpu:3] Intel(R) OpenCL HD Graphics, Intel(R) Graphics [0x020a] 3.0 [22.18.023111]
[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) Graphics [0x020a] 1.3 [1.3.23111]
[ext_oneapi_level_zero:gpu:1] Intel(R) Level-Zero, Intel(R) Graphics [0x020a] 1.3 [1.3.23111]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]&lt;/LI-CODE&gt;
&lt;P&gt;The oneAPI (compiler) version is 2022.1.0. But I do not know how to check the driver version.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;It seems that this is because memory leak, but there are no process on the GPU and we have no tools to confim GPU memory usage.&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;And the driver seems not stable enough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any way, it's a nice product but it's a pity that I am not able to fully utilize it. Programming with SYCL is amazing. Could you provide some doc or any resources to write wonderful program for Xe GPU, please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 14:21:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/using-multiple-malloc-device-cause-error/m-p/1407375#M2427</guid>
      <dc:creator>llll</dc:creator>
      <dc:date>2022-08-10T14:21:27Z</dc:date>
    </item>
  </channel>
</rss>

