multiple OpenCL applications and global memory effects

Hello !

I have multiple applications that use OpenCL and that run on the same workstation which has for simplicity say 1 OpenCL capable device.

So let’s take 2 applications A and B.
Application A is a persistent application where it runs 5 different kernels on a certain event triggered by the user/scheduler. Now each of these kernels depend on the output of the previously run kernel being stored in __global memory. This works perfectly when only application A is running on the workstation, as there seems to be no reason for the __global memory to get corrupted/modified by anyone else.

Application B is similar to Application A with say 3 kernels sharing __global memory between each other.

Now when application A and B run simultaneously:
– What are the possible effects or guarantees that I as an application developer can assume with OpenCL when multiple kernels from different contexts get executed and have __global memory persistence requirements ?
– Does the __global memory get persisted correctly for each OpenCL context created for applications A and B ?

Any help in this regard will be sincerely appreciated.


Different OpenCL contexts are isolated from each other in a similar manner that different processes are isolated.

Note I’m not saying that different OpenCL contexts are the same thing as different processes.

The operating system and/or device driver are responsible for device memory management and are free to page on and off data as needed.