Results 1 to 8 of 8

Thread: Using opencl in loop

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    15

    Using opencl in loop

    Hi, I am not able to solve an issue regarding opencl.

    My program flow is something like this:

    loop()
    {
    initGPU();
    makeSomethingOnGPU()
    destroyGPU();
    }

    I MUST put initialization and destroy steps inside the loop. After a number of correct iterations , it crashes giving CL_OUT_OF_HOST_MEMORY error and I am not able to understand why.
    I believe I destroy all resources. Following is the code

    initGPU: http://pastebin.com/g81aeuNG

    makeSomethingOnGPU: http://pastebin.com/YT3Am25g

    destroyGPU: http://pastebin.com/uqju4wp9

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Posts
    170
    You are leaking host memory in initGPU. If you run Task Manager you'll see that your memory usage just keeps growing. Everything that has a "new" must have a matching "delete".

  3. #3
    Junior Member
    Join Date
    Feb 2014
    Posts
    15
    Are you referring to various arrays? should it be done by java?

  4. #4
    Senior Member
    Join Date
    Dec 2011
    Posts
    170
    Oh, that's Java? Sorry, didn't catch that. Well, I can't help you much then except to still say that something is leaking host memory. Do you see Task Manager memory usage grow as your application runs?

    I might ask you you feel you must destroy and subsequently rebuilt the OpenCL platform, device, context, program, and kernels for each iteration through your loop. Seems wasteful.

  5. #5
    Junior Member
    Join Date
    Feb 2014
    Posts
    15
    Sorry, I forgot to mention it were Java. I ran Task Manager ("top" in linux systems) and I noticed that memory grows up until maximum (I can also hear the fan). I removed all variables and the problem per

    I might ask you you feel you must destroy and subsequently rebuilt the OpenCL platform, device, context, program, and kernels for each iteration through your loop. Seems wasteful.
    I am working with Hadoop framework and I need of initialize various nodes to work with its gpu. I do not think it is possibile to init just once.

  6. #6
    Junior Member
    Join Date
    Feb 2014
    Posts
    15
    Using a profiler I found that Buffers (byte[]) are not deallocated after each loop so they lie on GC (Garbage Collector). Is there a way to deallocate in opencl?

  7. #7
    Junior Member
    Join Date
    Feb 2014
    Posts
    15
    The problem moved to CL_OUT_OF_RESOURCES now.

  8. #8
    Junior Member
    Join Date
    Feb 2014
    Posts
    15
    Does anyone have same problem?

Tags for this Thread

Posting Permissions

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