viewon01's picture



I have write a Kernel that I execute a lot of times and after 1.300.000 calls to the kernel I receive a


I release (Dispose) all the buffers that I create, so do I have to do something else ?



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nythrix's picture

In general, you should check your device capabilities before launching any large data processing. For this purposes ComputeDevice exposes 50+ properties.

Tip of the day: "constant" and "local" memory are usually much smaller than "global". You can run out of those in no time.

I'm keeping an eye on this because the OutOfHostMemoryComputeException is an all time favourite even in my box.

viewon01's picture

Thanks for your advice,

I understand this... but what can I do ?

I have to pass 500.000 triangles to OpenCL to search for the triangle intersection !

I have use "constant" in order to "upload" all the triangle information at the startup... and not upload it... also it is important to have fast access to the triangle information and to the BVH (bounding volume hierarchy) information.

what solution I have ?


nythrix's picture

If the data don't fit into constant or (worse) global memory you'll have to split them into smaller chunks which you can process the good old way: one after another. Unfortunately, this is an algorithm specific task and as such lies way beyond the scope of Cloo.

viewon01's picture


I think you should implement a finalizer on the class ComputeResource, like this :

~ ComputeResource()
// Simply call Dispose(false).
Dispose (false);

It will simply ensure that the buffer is released when :
1 - we forgot to call Dispose and that we free the reference to the resource
2 - we debug and stop the application (the dispose is not yet called, but finalize should be ?)

Take a look at the article :

nythrix's picture

The finalizer is present in the ComputeResource. See here.

viewon01's picture


I have'nt see it :-)

Are you still working on your raytracer ? (What I'm currently working on too...). Have you find a way to shoot a "set of ray"... for opencl and not one ray at a time ?


nythrix's picture

I've been forced to put my hobby coding aside. Exams are all over me right now so no progress really. Besides, Cloo still has me quite involved.

As for your question. Raytracing basics tell us that every ray is independent on its neighbors. I'm not aware of any "many rays" vs "many primitives" algorithms and I'm not sure if they even exist.
However, I expect to see a big leap forward in this area once raytraced graphics becomes the next common light bulb.