Debug with VS2005 and Matlab: EmuDebug Mode fails!

hi all!

we’re using a modified version of this makefile for developing CUDA applications wrapped in Matlab mex files in our project.

we’re working on winXP machines with VisualStudio2005, CUDA 2.3 and Matlab 2009a.

so far we reached amazing speedups compared to our matlab implementations, just great how CUDA rocks! ;-)

but the problem is:

when we try to debug or just run our kernels in emulator debug mode the program execution hangs!

during debug (mex-file attached to the matlab process) it’s possible to step through the program and even into the first kernel. but when then the fist kernel is reached and we try to step out of the kernel or just reach a breakpoint located after the first kernel’s execution we never reach this point. the program hangs endless.

this also happens if we even don’t debug and only try to execute the mex-file - so matlab just freezes forever.

I’ve already checked the compiler and linker options and compared them with suggestions from the forum but without any success.

The mex-interface (pure C, no kernels) is compiled as follows:

cl /nologo /I"C:\Program Files\MATLAB\R2009a\extern\include" /I"C:\Program Files\MATLAB\R2009a-s\extern\include"  /I"C:\CUDA\include" /I"C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc"  /D"_CONSOLE" /D"WIN32" /D"_MBCS" /D"MATLAB_MEX_FILE"  /EHsc /W3 /Zi /c /arch:SSE2 /Fo"EmuDebug\" /Fd"EmuDebug\" /D"_DEBUG" /Od /MTd /Tp .\Gradient_MexInterface.cpp

The file containing kernels is compiled fist by nvcc: (i guess the error is most probably located here?!?)

C:\CUDA\bin\nvcc.exe --cuda --gpu-architecture=sm_10  -DMATLAB_MEX_FILE -DWIN32 -D_MBCS -D_CONSOLE -maxrregcount=10  -I"C:\CUDA\include" -I"C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc" -deviceemu -D_DEVICEEMU -D_DEBUG -o EmuDebug/Gradient.cu.cpp ../../Gradient.cu

…and afterwards [b]passed to the VS2005 CL-compiler:

[/b]

cl /nologo /I"C:\Program Files\MATLAB\R2009a\extern\include" /I"C:\Program Files\MATLAB\R2009a-s\extern\include"  /I"C:\CUDA\include" /I"C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\inc"  /D"_CONSOLE" /D"WIN32" /D"_MBCS" /D"MATLAB_MEX_FILE"  /EHsc /W3 /Zi /c /arch:SSE2 /Fo"EmuDebug\" /Fd"EmuDebug\" /D"_DEBUG" /Od /MTd /Tp ./EmuDebug\Gradient.cu.cpp

to link all the files we execute the following:

link.exe /nologo /DLL /SUBSYSTEM:CONSOLE /MACHINE:X86  /LIBPATH:"C:\CUDA\lib" /LIBPATH:"C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\common\lib"  /LIBPATH:"C:\Program Files\MATLAB\R2009a\extern\lib\win32\microsoft"  /LIBPATH:"C:\Program Files\MATLAB\R2009a-s\extern\lib\win32\microsoft" /DEBUG /EXPORT:mexFunction /OUT:EmuDebug/cuGradient.mexw32 EmuDebug/Gradient_MexInterface.obj EmuDebug/Gradient.cu.obj EmuDebug/Utils.obj cudart.lib libmat.lib libmx.lib libmex.lib kernel32.lib cutil32D.lib

when using debug or release mode (no emulation!!) the program works fine! External Image

any ideas?

thanks for your help in advance!

fab