OpenCL fuerza el búfer para permanecer en la GPU

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.

¡Gracias!

preguntado el 10 de marzo de 12 a las 12:03

1 Respuestas

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.

respondido 11 mar '12, 02:03

But then how come when I, say, create a 128MB buffer on the GPU (via cl_mem), and writing some stuff in it: if I immediately read back the data, it will be instant, whereas if I leave it there for a few hours (without releasing it, of course) while playing for instance a GPU memory-heavy game, then try and access my memory again, it will take roughly one second - precisely the amount of time needed to read 128MB from my hard drive. Surely if the data was still on the GPU, it would not take a second to read it back, considering PCI-E bandwidth (which I rated at roughly 4.5GB/s both ways)? - Thomas

I may as well accept this answer, it doesn't really matter for what I want to do anyway. Thanks! - Thomas

OK, I better understand the issue. What make and model GPU was this? What version of OpenCL? I will try and repo the issue. - Tim niño

Hd6950 2GB, Cayman (standard). OpenCL 1.1, not sure about the details, will check at home (in 4 hours). I can give you the OpenCL code then as well if you want - Thomas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.