PDA

View Full Version : Query Memory used on GPU



clint3112
11-09-2012, 05:26 AM
Hi there,

I could not find a way to query the actual amount of GPU memory used. Is there a way to get this informations from openCL. All I found was the overall maximum global memory available. What I want to know is the free global memory or the used global memory.

Or is there only the solution to wait until a query returns CL_OUT_OF_RESOURCES?

Greetings,
Clint3112

notzed
11-11-2012, 05:59 PM
I suspect there isn't such a query as it isn't something that can really be calculated.

buffers and images only need to be 'on card' when a kernel using them is executing, they could otherwise be in system memory or even conceivable swapped to disk.

In other words, OpenCL's api deliberately visualises these resources on purpose to make it easier to use, so 'how much is left on the device' isn't terribly useful.

notzed
11-11-2012, 06:15 PM
In other words, OpenCL's api deliberately visualises these resources

Err, virtualises that was supposed to be.

clint3112
11-12-2012, 05:26 AM
Thanks for the answer.

this means, an out of ressources error would only happend if the data for the kernel thats being computed is larger than the memory available on the card? Or can it happen that i run out of memory because the gpu tries to buffer some data for the next things in queue?

Greetings,
clint3112

notzed
11-12-2012, 04:20 PM
Thanks for the answer.

this means, an out of ressources error would only happend if the data for the kernel thats being computed is larger than the memory available on the card? Or can it happen that i run out of memory because the gpu tries to buffer some data for the next things in queue?

Greetings,
clint3112

The precise details would depend on the driver and implementation - and such details are proprietary.

But both of those scenarios seem likely possible causes to me (of several).

Note that although the api allows virtualisation, it doesn't mean a given implementation takes advantage of it ... although I would think a mature implementation would need it to remain competitive although that is only conjecture.

jai
11-17-2012, 12:25 AM
what is the difference between
cl_mem input = clCreateBuffer(context,CL_MEM_READ_ONLY,sizeof(flo at) * DATA_SIZE, NULL, NULL);
clEnqueueWriteBuffer(command_queue, input, CL_TRUE, 0, sizeof(float) * DATA_SIZE, inputdata, 0, NULL, NULL);

and

cl_mem input = clCreateBuffer(context,CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, ,sizeof(float) * DATA_SIZE, inputdata, NULL);