CUDA with Emacs

Hello everyone,

I like to use emacs, but somehow when I try to compile some CUDA code within emacs it doesn’t work because the path I have in emacs is different from the path of my bash, and therefore nvcc cannot be find.

How can I fix this? I have looked in the forum for previous messages and also in google, but I couldn’t figure this out.

Thanks

What i do is to cd into $NVIDIA_SDK/projects/MyProject and there invoke ‘make edit’, having the following at the end of my Makefile:

edit:

	   @exec emacs --no-splash -font 9x15 \

	   Makefile $(CUFILES) $(CU_DEPS) $(CFILES) $(CCFILES) &>/dev/null &

M-X compile now works as intended and the shell is free to go anywhere else you’d like

I am not sure I follow.

As a diehard vim user I am loathe to admit I know this, but Emacs has a native compile mode (ESC-x compile) which will fork a make command in the current working directory. Within a Makefile you have the freedom to define paths and actions to your hearts desire, totally independent of the process that forks it. Emacs will even back parse the compiler output and highlight errors and warnings from the compiler. The compile mode has been that way for as long as gcc has existed (over 20 years) and perhaps even longer.

It is working now! I don’t even need to use --no-splash or -font.

The thing is that I was used to load emacs with Alt+F2 (in Gnome) and then when I call M-x compile it does not find nvcc, but if I load emacs from the directory of the project I’m working, it finds the nvcc compiler.

Thanks a lot!