Can enqueueNDRangeKernel leak memory even without events?

Hi,

I have posted this Memory leak in OpenCL under Linux when the number of kernels calls is huge - CUDA Programming and Performance - NVIDIA Developer Forums on nvidia forum but I still could not find a solution. I am facing a memory leak in OpenCL that only happens when I call the kernel a large number of times, around 10^8 times. I am aware that memory leaks are expected when events are used and not released, but can this happens when not using them? My code is a little big but I can post parts of it here if it helps. I am using the c++ wrapper and calling the kernel this way


a.global_size = {p.N_first_reduction};
a.local_size = {p.local_size};
p.queue.enqueueNDRangeKernel(p.E_int, a.kernel_offset, a.global_size, a.local_size);

As I sad on nvidia forum I tried


a.global_size = {p.N_first_reduction};
a.local_size = {p.local_size};
p.queue.enqueueNDRangeKernel(p.E_int, a.kernel_offset, a.global_size, a.local_size, NULL, NULL);

But nothing has changed. Is there a way to find what is goig wrong?

Thanks in advance

I found issues with older drivers where they leaked small amounts of memory that could accumulate over very large numbers of kernel calls. Try to figure out about how many bytes per kernel you are losing (by dividing the leak size by the kernel count after running many kernels). Then try changing aspects of how you are calling the kernel to see if you can get the number to change. See if it is the same or different between vendors (e.g., AMD and NVIDIA).

Hi,

I will look into that but I don’t know if such calculation will be possible… As far as top can tell the used memory remains the same almost the whole time(around 2 hours)… When suddenly it explodes. In a few seconds it goes from 70 mb to around 4 gb and then the executable is killed by the kernel…

Unfortunately I do not have an AMD card to perform tests… I will see if I can test the code on the processor, but it could take days to get to the same point running on it…