4
votes

is there a way to force OpenCL to keep data in a global memory buffer on chip (i.e. it never gets swapped out to system memory)? Basically I want to reserve a portion of the GPU's memory for my own needs, and I want the data that I put there to remain on the GPU regardless of whether other applications start saturating the GPU's memory.

Thanks!

1

1 Answers

4
votes

GPU's aren't linked to a CPUs memory management unit, they don't do page faults like a CPU. They are block device peripherals controlled by device drivers.

For OpenCL when you allocate memory on the GPU by creating a cl_mem object and enqueueing (writing) it to the GPU it will stick around until you explicitly release is with clReleaseMemobject. To reuse a buffer you need to not release it and keep track of its Cl_mem object.