Device Emulation Question

I am trying to get my CUDA program to run in the device emulation mode for debug, however I cant seam to get it to work. I have been using the standard make files that come with the demos, but can’t find a way to set the -deviceemu flag in the makefile. I also tried compiling with nvcc, however I can’t seam to get it set up right for all the links to get set up right. I am a new Linux user, not using it before the system my project is on so if anyone can tell me how to get this setup correctly it would be extremely helpfull.

It’s a bit unclear in the docs, and UNIX has such a lame learning curve, but the “make” command will take flags. In this case, with the CUDA project including the NVIDIA-written base makefile “common.mk”, the CUDA build system will take flags such as “emu=1” and “dbg=1”. So: “make emu=1 dbg=1” will give you a full-debug emulated binary.

edit: added some detail

When I tried it, the make file ran, however the printf lines I added to the kernel file don’t seam to be printing.

Interesting - what about searching the sample project kernel files for printf usage?

Try going to the “projects” directory and typing:

“find . | grep kernel | grep cu$ | xargs -I KERNELFILE grep -H print KERNELFILE”

UNIX voodoo:

This lists all files under the current dir, searches that list for lines containing “kernel” and ending with “cu”, and passes all those filenames to an in-file search looking for “print” in the files.

I figured it out, I didn’t know that when you make it with the flags set it stores the executable in a different directory. Thanks for the help.