- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us!
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().
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.
Could you please send us a sample code/ pseudo code if possible which depicts the problem statement that you are trying to solve.
Thanks & Regards
Goutham
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us!
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().
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.
Could you please send us a sample code/ pseudo code if possible which depicts the problem statement that you are trying to solve.
Thanks & Regards
Goutham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please confirm if your issue is resolved?
If not, provide us a sample code/ pseudo code that depicts the problem statement that you are trying to solve?
Regards
Goutham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes -- thanks. (I thought that was implied after selecting your post as the solution.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the confirmation!
As this issue has been resolved, we will no longer respond to this thread.
If you require any additional assistance from Intel, please start a new thread.
Any further interaction in this thread will be considered community only.
Thanks & Regards
Goutham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A SYCL context contains a collection of devices that the host can use and manages memory objects that can be shared between the devices.
Multiple devices on same platform can share a context, and multiple queues can share same context.
SYCL USM data is accessible on other devices in same context.
auto P = sycl::platform p(sycl::gpu_seclector_v);
auto devices = P.get_devices();
auto C = sycl::context(devices);
sycl::queue q0 = new sycl::queue(C, devices[0]);
sycl::queue q1 = new sycl::queue(C, devices[1]);
a = sycl::malloc_device<float>(N, q0);
b = sycl::malloc_device<float>(N, q1);
q0.memcpy(a, host_a, sizeof(float) * N).wait();
q1.memcpy(b, host_b, sizeof(float) * N).wait();
q0.parallel_for(sycl::range{N}, [=](sycl::item<1> i) {
a[i] += b[i]; // buffer b on device 1 is added to buffer a on device 0
});
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page