Re: [Ecp-aurora-sdk-discuss] SYCL contexts with iGPU
FYI: https://www.khronos.org/registry/SYCL/specs/sycl-1.2.1.pdf Page 33, paragraph 4 gives a good explanation of contexts and queues. Vince
On Aug 12, 2020, at 3:40 PM, Vincent R. Pascuzzi <[email protected]> wrote:
Hi, Kevin.
Thanks a lot for the quick reply!
Coincidentally, I used a shared context before as the same problem popped up earlier in my development, but it turned out to be due to one queue being associated to the ‘host’ device and the other to the ‘GPU’ device. Having both use the same device fixed the problem, so I ignored the context sharing since I assumed "same device, same context.”
Guess this isn’t quite right. I will go back to the shared context and see what happens.
Food for thought: Since CUDA doesn’t isn’t context-oriented like OpenCL, I wonder how this business will work with the CUDA PI…I should try.
Best, Vince
On Aug 12, 2020, at 3:12 PM, Harms, Kevin <[email protected]> wrote:
Vince,
I think the Intel dpc++ creates a new context for each queue even if the queues use the same device. When you allocate queues, you can pass the context it should use in the constructor. If you try that, you can see if it fixes the issue. You can get the context from the first queue you create.
kevin
________________________________________ From: Ecp-aurora-sdk-discuss <[email protected]> on behalf of Vincent R. Pascuzzi via Ecp-aurora-sdk-discuss <[email protected]> Sent: Wednesday, August 12, 2020 5:01 PM To: [email protected] Subject: [Ecp-aurora-sdk-discuss] SYCL contexts with iGPU
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.
Is this correct?
A summary of my problem: I generate random numbers in one class and store put them into the memory of an Iris node’s Neo device using a cl::sycl::queue member variable in this class. In another class, I allocate a bunch of memory on the ‘same’(?) Neo device using a cl::sycl::queue 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 cl::sycl::queue 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.
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?)
Thanks in advance.
Vince
-- Ecp-aurora-sdk-discuss mailing list [email protected] https://lists.jlse.anl.gov/mailman/listinfo/ecp-aurora-sdk-discuss
participants (1)
-
Vincent R. Pascuzzi