I am having a very weird problem. So basically I have converted my parallel kernels to one sequential kernel. I have modified host code and done cross checking of code and so on. It does work. I do clean buffer before each iteration but for some reason after a certain number of iterations the kernel fails and it throws this error: CL_INVALID_COMMAND_QUEUE. So as far as I know this means the kernel has failed but it doesn’t make any sense because it works for previous iterations and then it doesn’t for new ones.
So in order to overcome this problem I re-initialize all the OpenCL variables (command queue, context and so on) dynamically once in a while every 50 iterations and now it goes through all the iterations.
I am running the code on my NVIDIA GPU. What could it be causing this problem? I do release the buffers and re-initialize them… Also if I run it on CPU it fails randomly…
One more thing is, if I want to run it on GPU all clReleaseMemObject calls have to be changed to clRetainMemObject otherwise it would sometime throw again that error after less iterations, On CPU is the opposite, I need to switch all clRetainMemObject to clReleaseMemObject to make it work but now it’s not working.