Win 7, CUDA, crashing in cudaMallocPitch

Hi, hope someone can help, I’ve spent a lot of time on this problem!

Here’s my setup:

Win 7 x64, VS2008 express

GTS 250 with latest dev driver (x64)

Cuda 3.2 and latest NPP

I’m compiling a 32 bit application (maybe this is relevant?). I’m using the OpenCV library, which has some CUDA support. However, I believe this to be a problem with CUDA, or more likely my setup, because the most elementary task as creating a matrix (assigning memory on the GPU) is failing.

I have a completely empty project, and I create a matrix instance:

cv::gpu::GpuMat image(100,100,CV_8UC1);

When I run this, the program hangs, using 100% CPU and leaking memory.

I can trace this to the following call in OpenCV:

void *dev_ptr;

cudaSafeCall( cudaMallocPitch(&dev_ptr, &step, esz * cols, rows) );

All the values being passed to the function seem reasonable, however, the program never returns from the call to this function. Something is obviously going wrong inside it!

Here’s some output from the debug log:

First-chance exception at 0x7760b727 in Cuda.exe: Microsoft C++ exception: cudaError at memory location 0x0043f49c..

..... (lots of these)

First-chance exception at 0x7760b727 in Cuda.exe: Microsoft C++ exception: cudaError at memory location 0x0043f494..

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\nvcuda.dll', Binary was not built with debug information.

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll'

'Cuda.exe': Unloaded 'C:\Windows\SysWOW64\dwmapi.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\nvapi.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll'

'Cuda.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll'

First-chance exception at 0x7760b727 in Cuda.exe: Microsoft C++ exception: cudaError_enum at memory location 0x0043f99c..

... (lots of these)

Can anyone give me any pointers on what could be going wrong?

Thanks!

Me too

What error message is given from the cudaMallocPitch function call? You can find out by removing the cudaSafeCall function and declaring a cudaError_t variable to assign the output to, i.e.

cudaError_t err = cudaMallocPitch(&dev_ptr, &step, esz * cols, rows);

Or for that matter, just post the relevant code that’s failing and we can try seeing what’s wrong.