CUDA Emulator

Hey all,

I’m quite new to this CUDA stuff and want to get acquainted with it. My machine does not have the CUDA hardware requirements however throughout the documentation I have read it states it is possible to use a CUDA emulator. In all the documentation however, it does not state on where to obtain such an emulator. If perhaps someone could push me in the right direction I’d be most appreciative. Thanks again.

The emulation mode is built in the compiler. It’s not really emulation, it just targets the CPU instead of the GPU. It’s horribly inefficient in doing that, you can expect emulated code to run hundreds of times slower than native CPU code doing the same thing, but you can use it to learn the API, syntax and whatnot. You will not experience all the problems you might run into on real hardware if you code badly though - emulation mode frequently fails to reveal race conditions and such.

To compile in emulation mode you need to pass a certain parameter to the compiler (IIRC -emu or something like that, see nvcc documentation).

Also, since emulated code is on the host, “device” pointers and host pointers point to the same memory and you may be able to use host pointers in “device” code and vice-versa. This is an unwanted behaviour and bugs related to that will surface only when you run real code.

I’ve looked through that documentation here:…ompilerInfo.pdf

and cannot find specifically how or where to add this. Any pointers on how to accomplish that? Thanks again.

Page 14 of the documentation you pointed to (page 16 in pdf file):

Yeah I saw that, I’m just a little unsure of how to actually execute the program in emulation mode. I’ve tried navigating to the SDK examples and attempting different commands. For example " nvcc deviceemu " Where is from the transpose provided SDK examples. I’ve tried this among many other combinations but to no avail. I know this sounds incredibly low level but what would I need to literally type out to compile in emulation mode?

Thanks again for your help

This is what I learned from my first practice, the pointers help to hide the bug under emulation mode.

I think “nvcc -deviceemu” should work?
You forgot the minus before deviceemu, which is important. Otherwise the compiler thinks it is a file under that name to read!

Check out “Ocelot”