PDA

View Full Version : OpenCL - clEnqueueReadBuffer problem


Jofo
26-Apr-2010, 18:33
Hello,

I'm implementing a resampler with FIR filter in OpenCL and I'm experiencing some strange behaviour with clEnqueueReadBuffer function. I'm using GeForce GTX 275 with 190.89 drivers, Windows 7 32-bit.


My resampling function is cyclically called, every time with new input data. In first iteration, necessary buffers are created (input and output), after that only input is written to GPU using clEnqueueWriteBuffer (blocking), kernel executed (parameters set in 1st iteration), then blocking read with clEnqueueReadBuffer.

And here comes the trouble. I'm testing it on 10000 iterations, but with the same data, something like this:



//Make resampler object
//Make 2 float arrays
//Load
input array with some data
//Set filter coefficients, resampling
ratio

for(i=0;i<10000;++i)
{ res =
resampler.resample(INPUT_LEN,input,output); //res==0 means error

if(res==0)
break;
}



I get -5 return code from clEnqueueWriteBuffer when reading computed data, but after random number of iterations. Sometimes its cca 7000, sometimes it crashes after second iteration, but seems quite random. Never got higher than cca 7300 iterations and never below 2. Whats the problem? And what does the return code mean? Its not a value specified in sepcification document.

I tested it on the same machine, but with 8800GTX - same result. But on my friends notebook (8600M GT, Win7 64-bit, same drivers), one million iterrations was not a problem, it ran flawlessly.

Whats the problem? I'm getting no answers on nVidia forums...

pcchen
26-Apr-2010, 18:41
Error code -5 is CL_OUT_OF_RESOURCES. This could be from a previous kernel execution call.
Anyway, you should try newer driver if possible. 190.89 is pretty old with an older OpenCL implementation. You may want to try latest driver with NVIDIA's CUDA 3.0 toolkits, which contains an OpenCL SDK compatible with latest driver (which also supports OpenCL ICD so it's also compatible with AMD's OpenCL implementation).

Jofo
26-Apr-2010, 18:55
197.13 then? Because I once tried another driver, but OpenCL (even examples at GPU Computing SDK) didnt work.

Jofo
26-Apr-2010, 18:58
I'm using GPU COmputing SDK 2.3 btw


(where is post editing button? )

pcchen
26-Apr-2010, 19:03
The 2.3 sdk is very old and very buggy. If you can use newer driver you should use 3.0 SDK instead.

Jofo
26-Apr-2010, 22:06
So.... uniinstalled both drivers and SDK. Installed 197.13 developer drivers and CUDA SDK 3.0. Changed include and library directories in Visual Studio, cleaned and recompiled my program, no errors. And guess what... I cannot even create context, it crashes. Moreover, driver properties says this:

http://s10.directupload.net/images/100426/temp/mjhiq3ro.png (http://s10.directupload.net/images/100426/mjhiq3ro.png)

Jofo
26-Apr-2010, 22:51
Ok, round #2. Uninstalled everything that had "nVidia" in its name, including physx, stereo driver, etc. Now the driver says correct things, but my program will not run.... clCreateContextFromType returns CL_INVALID_PLATFORM...

OpenGL guy
26-Apr-2010, 23:24
Ok, round #2. Uninstalled everything that had "nVidia" in its name, including physx, stereo driver, etc. Now the driver says correct things, but my program will not run.... clCreateContextFromType returns CL_INVALID_PLATFORM...
Sounds like OpenCL.dll is present but the NVIDIA OpenCL driver isn't.

mhouston
27-Apr-2010, 01:43
Did you change your CL code to properly enumerate the platforms? "NULL" is no longer a valid platform.

Jofo
27-Apr-2010, 08:18
Thank You!

I didn't notice that NULL is valid no more (actually, I copied some parts of initialization from nV examples), but works now.

Dade
27-Apr-2010, 08:22
I didn't notice that NULL is valid no more (actually, I copied some parts of initialization from nV examples), but works now.

It has been changed with the fully support of the OpenCL ICD, some information is available here: http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71

tmavr
02-Sep-2010, 16:07
Hi Jofo
any chance that you are implementing an open source FIR upsampler /crossover ?
any chance of sharing your insight and/or perhaps parts of code ?
I would be extremely interested...