Installing CUDA compiler/debugger for NetBeans IDE on Linux Ubuntu
I use Netbeans everyday as my main IDE for Java and C++ projects, and here is my experience using it for CUDA. With it you have everything you need compile projects with colored syntax and auto-complete and also debug step by step, view variables… I use Ubuntu 7.10 but it should be about the same for Windows except the “path” and “lib”.
I think it could be interesting for users who don’t already have an IDE and it’s FREE!
How to install?
After installing CUDA toolkit, SDK, video driver…
download nebeans 6.0 on http://www.netbeans.org/ all or C++ only
open new project c/c++ application
how to have the keywords colored for a .cu file extension?
in the menu tool–>option button advanced
open “IDE Configuration” folder on the left tree
open “System” folder
open “Object Types” folder
select “C Data Object” and add “,cu” at the end of “Extensions and MIME type”
close the option box
how to create a source file?
on the left project tree, right click on “Source Files”
New–>Other create an “empty file” and name it whatever.cu
the next time the menu will show the New–>Empty file right away
how to create a kernel source file that is used with #include from the main .cu file?
same as a .cu file except at the end, right click on the file and “properties”
and in the General category, check the box “Excluded from build”
how to compile?
Right click on your project and “properties”
In the General tab, uncheck both “C compiler required” and “C++ compiler required”, select “Generic” in the list box of “Platform”
On the tree select “C/C++”–>“C Compiler”–>“General”
and change the include directories to somewhat like that:
modify to your very path.
and in the “Tool” type nvcc
noe in the “C/C++”–>“C Compiler”–>“Command Line” set these options -v -deviceemu --compile -G0
do exactly the same for the “C/C++”–>“C++ Compiler”
now set the linker, in the same properties box, select “Linker”–>“General”, change “Tool” to nvcc
in the “Linker”–>“Libraries” add “cudart” and cutil with th e"Add Library button" select .a and get the library for your “NVIDIA_CUDA_SDK/lib/libcuda.a”
same for cudart but select dynamic library “.so” and get it from /usr/local/cuda/libcudart.so
put “–link” in the “Linker”–>“Command Line”
and “OK” the project properties box
everything should work well if you have the right path for lib and nvcc in your system environment
I couldn’t find an easy way to set the LD_LIBRARY_PATH on Ubuntu, so if you know… anyway I have modified the /etc/ld.so.conf.d/libc.conf and add the cuda lib at the end, it require to restart the machine, I know it’s bad but works well :">
libc default configuration
Same for the path to nvcc
I have modified the /etc/environment