Results 1 to 6 of 6

Thread: Query Memory used on GPU

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    165

    Query Memory used on GPU

    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

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: Query Memory used on GPU

    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.

  3. #3
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: Query Memory used on GPU

    Quote Originally Posted by notzed
    In other words, OpenCL's api deliberately visualises these resources
    Err, virtualises that was supposed to be.

  4. #4
    Senior Member
    Join Date
    Oct 2012
    Posts
    165

    Re: Query Memory used on GPU

    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

  5. #5
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: Query Memory used on GPU

    Quote Originally Posted by clint3112
    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.

  6. #6

    Re: Query Memory used on GPU

    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);

Similar Threads

  1. Efficient use of memory in GPU
    By Gamingdrake in forum OpenCL
    Replies: 2
    Last Post: 07-06-2011, 03:33 PM
  2. GPU Query
    By loriordan in forum OpenCL
    Replies: 1
    Last Post: 11-20-2009, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •