<?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:SYCL contexts and memory access in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1201557#M663</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could you please confirm if your issue is resolved?&lt;/P&gt;&lt;P&gt;If not, provide us a sample code/ pseudo code that depicts the problem statement that you are trying to solve?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 19 Aug 2020 08:13:17 GMT</pubDate>
    <dc:creator>GouthamK_Intel</dc:creator>
    <dc:date>2020-08-19T08:13:17Z</dc:date>
    <item>
      <title>SYCL contexts and memory access</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1199873#M640</link>
      <description>&lt;P&gt;&lt;SPAN&gt;My understanding of the &lt;FONT face="courier new,courier"&gt;cl::sycl::context&lt;/FONT&gt; is that they are used among the different devices on a system. For example, I can only access memory allocated on a given&amp;nbsp;&lt;FONT face="courier new,courier"&gt;cl::sycl::device&lt;/FONT&gt;&amp;nbsp;using a&amp;nbsp;&lt;FONT face="courier new,courier"&gt;cl::sycl::queue&lt;/FONT&gt; that was instantiated with the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;cl::sycl::context&lt;/FONT&gt; associated to said device, i.e. using&amp;nbsp;&lt;FONT face="courier new,courier"&gt;cl::sycl::device::get_context()&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Is this correct?&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;A summary of my problem: I generate random numbers in one class and store put them into the memory of an Neo device using a&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;cl::sycl::queue&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;member variable in this class. In another class, I allocate a bunch of memory on the ‘same’(?) Neo device using a&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;cl::sycl::queue&lt;/FONT&gt;&lt;/SPAN&gt; member variable in this other class. I get the associated device in both classes with the same common static function, i.e. the same Neo device is used. There are 3-4 classes that are implemented similarly. Now, it seems in some cases that I can use a single&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;cl::sycl::queue&lt;/FONT&gt;&lt;/SPAN&gt; from an arbitrary class to access data allocated in other classes, but in other cases I can’t; I need to use the queue/context that was used to allocate the memory. Of course I can’t operate this way since I need to access data stored among multiple classes using a single queue.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Is there a preferred/common/proper way to achieve what I want to do? Should I have a global “queue manager” class of sorts that uses a single queue/device/context to take care of all device-side tasks? Should I be explicitly using the same context is shared among all classes? (I wouldn’t think this mattered if my understanding of contexts is correct, and there is only a single iGPU on each machine. Unless there is different memory that is not shareable among different&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;cl::sycl::queue&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;objects?)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Vince&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Aug 2020 22:06:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1199873#M640</guid>
      <dc:creator>Pascuzzi__Vincent</dc:creator>
      <dc:date>2020-08-12T22:06:52Z</dc:date>
    </item>
    <item>
      <title>Re:SYCL contexts and memory access</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1200013#M644</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us!&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;My understanding of the cl::sycl::context is that they are used among the different devices on a system. For example, I can only access memory allocated on a given cl::sycl::device using a cl::sycl::queue that was instantiated with the cl::sycl::context associated to said device, i.e. using cl::sycl::device::get_context().&lt;/LI-CODE&gt;
&lt;P&gt;When you create multiple queues even with the same device, multiple contexts get created. As they are two different SYCL contexts and any buffer you create will be a part of that context.&lt;/P&gt;
&lt;P&gt;Could you please send us a sample code/ pseudo code if possible which depicts the problem statement that you are trying to solve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;
&lt;P&gt;Goutham&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 12:23:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1200013#M644</guid>
      <dc:creator>GouthamK_Intel</dc:creator>
      <dc:date>2020-08-13T12:23:41Z</dc:date>
    </item>
    <item>
      <title>Re:SYCL contexts and memory access</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1201557#M663</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could you please confirm if your issue is resolved?&lt;/P&gt;&lt;P&gt;If not, provide us a sample code/ pseudo code that depicts the problem statement that you are trying to solve?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2020 08:13:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1201557#M663</guid>
      <dc:creator>GouthamK_Intel</dc:creator>
      <dc:date>2020-08-19T08:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Re:SYCL contexts and memory access</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1201674#M664</link>
      <description>&lt;P&gt;Yes -- thanks. (I thought that was implied after selecting your post as the solution.)&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 13:45:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1201674#M664</guid>
      <dc:creator>Pascuzzi__Vincent</dc:creator>
      <dc:date>2020-08-19T13:45:21Z</dc:date>
    </item>
    <item>
      <title>Re:SYCL contexts and memory access</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1202401#M668</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Thanks for the confirmation!&lt;/P&gt;&lt;P&gt;As this issue has been resolved, we will no longer respond to this thread.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you require any additional assistance from Intel, please start a new thread.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any further interaction in this thread will be considered community only.&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;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Aug 2020 09:20:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1202401#M668</guid>
      <dc:creator>GouthamK_Intel</dc:creator>
      <dc:date>2020-08-21T09:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: SYCL contexts and memory access</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1580580#M3547</link>
      <description>&lt;P&gt;&lt;SPAN&gt;A SYCL&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;context&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;contains a collection of devices that the host can use and manages memory objects that can be shared between the devices.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Multiple devices on same platform can share a context, and multiple queues can share same context.&lt;/P&gt;&lt;P&gt;SYCL USM data is accessible on other devices in same context.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;auto P = sycl::platform p(sycl::gpu_seclector_v);&lt;BR /&gt;auto devices = P.get_devices();&lt;BR /&gt;auto C = sycl::context(devices);&lt;BR /&gt;sycl::queue q0 = new sycl::queue(C, devices[0]);&lt;BR /&gt;sycl::queue q1 = new sycl::queue(C, devices[1]);&lt;BR /&gt;a = sycl::malloc_device&amp;lt;float&amp;gt;(N, q0);&lt;BR /&gt;b = sycl::malloc_device&amp;lt;float&amp;gt;(N, q1);&lt;BR /&gt;q0.memcpy(a, host_a, sizeof(float) * N).wait();&lt;BR /&gt;q1.memcpy(b, host_b, sizeof(float) * N).wait();&lt;BR /&gt;q0.parallel_for(sycl::range{N}, [=](sycl::item&amp;lt;1&amp;gt; i) {&lt;BR /&gt;  a[i] += b[i];  // buffer b on device 1 is added to buffer a on device 0&lt;BR /&gt;});&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Mar 2024 20:50:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/SYCL-contexts-and-memory-access/m-p/1580580#M3547</guid>
      <dc:creator>Gregg_S_Intel</dc:creator>
      <dc:date>2024-03-14T20:50:45Z</dc:date>
    </item>
  </channel>
</rss>

