CUDA emudebug? How to enable in Visual Studio 2005?

Hey guys, I’ve just started programming in CUDA and I’ve been reading on this forums on what debugging options are available to me. I am using Visual Studio 2005, would you guys be able to tell me how do I turn on emudebug? Is this any different than standard debug mode? I am currently just working from my home computer so everything is done in emulation (only the lab computers have the 8800s).

Also, when errors occur and I double click on the error, it does not skip to the line number where the error occurred just like it would normally for any other programming language, is this normal?

Lastly, is there a way for me to inspect my kernel functions and device memory to see what their values are in each step during execution?


Hmm, as far as I know “-deviceemu” is the only option that forces the compiler to generate code which is executed by the host (CPU) and enables debugging.

Jepp. You have to live with that.

No. Not yet. You can not debug your kernel if it’s being executed by the device.

The only way to debug your code is to have it being executed by the host ("-deviceemu" option, you know).

Maybe you have found the answer,If I understand what you said right,you can’t fing the "emudebug"in the selected debug box,only debug and release mode aviable.Using the “templete” programe in SDK ,change the code you can use emudebug mode.Maybe it’s a stupid method,but it works fine.

If I use -deviceemu, I can inspect the values of each variable while stepping through the (emulated) kernel functions?

Yes you can, but this is very hard because of the threads you have. Your code is very small but you can have thousands of threads. This is one thing that makes it this hard to program on the GPU I think.

Also you can take a look at Valgrind if you have problems with memory allocation and that sort of stuff

Thanks, to enable -deviceemu, I change this at Project -> ‘project’ Properties -> CUDA -> CUDA-Specific -> Emulation set to Yes and Build -> Configuration Manager -> Configuration set to Debug. Is that it? Because even now, when I set breakpoints in the kernel function, I am still not able to step through it line by line.

And for some reason, it says “CUDA_SAFE_CALL” is not defined, what does that mean?

Make sure that you has already included <cutil.h>.I think you could post your code if it is not very big.
In Emudebug ,you can step through it line by line ,maybe you should try to emudebug the sdk sample to understand it much more.
Good luck.

I emudubbed teh SDK samples and they work fine. But my project doesn’t debug correctly, what other settings could they have changed that I have not failed to do? The only thing I have changed is turning on emulation and configuring Build to Debug.

Where do you see this in Visual Studio? When I go to the project properties dialog box, I do not see any CUDA specific options. When I select the EmuDebug configuration I am able to step through the kernel code fine. Does this mean I am in emulation mode?

The run time of my emuDebug code on the CPU is much larger than I expected. The execution time is 170 seconds versus 300 milliseconds on the GPU. I can also see that my quad-core CPU is only running at 25% usage. Does this mean maybe I am selecting an incorrect setting for emulation? Can I get emulation mode to use all 4 cores on my CPU for a more accurate indication of execution time?

When I changed a project in SDK and to build,it always pop up a "save file as "window. When I select the “yes” button. It can’t be save.
So I can’t compile any project in CUDA SDK.It is very strang
Anyone know what’s wrong?

EmuDebug is supposed to be slow. The threads execute mostly sequentially and only on a single CPU core.

EmuRelease is only slightly faster (as it generates optimized code, which is less suited for single stepping

and debugging).

nVidia hinted that they may support a ISSE2 / multi core target for the PTX backend some time in the future.

This would be cool - but at the same time enable CUDA PhysX also for the CPU. Maybe that is why it is delayed

so much - it could be a deliberate marketing choice.

Just in case somebody else needs this information.

To enable EmuDebug in Visual Studio 2008 / CUDA SDK 2.3:

  1. Apply Custom Build Rules to your CUDA project, following tips available here:

  1. Go to project properties page, now you have “CUDA Build Rule” at the bottom of the tree. Open the General page.

  2. Set the following:

  • Generate Debug Information: Yes

  • Emulation Mode: Yes

  • Optimization: Disabled

And you should be able to use the EmuDebug mode like in the sample projects.

Hope this helps.

Thank you.