Cuda Compilation in Linux

We come to the basic topic of Linux and compilation for CUDA. So purely documented but yet Nvidia has given a nice common.mk file in the SDK so that a programmer can do some decent working on especially when he/she wants to bind c++ and cu files (for instance look at the cppIntegration example of SDK) you arrange your cpp files and your cu files nicely in the basic Makefile.
like :

Add source files here

EXECUTABLE := cppIntegration

Cuda source files (compiled with cudacc)

CUFILES := cppIntegration.cu

C/C++ source files (compiled with gcc / c++)

CCFILES :=
main.cpp
cppIntegration_gold.cpp \

And then in the common file the compilers are nicely arranged like:

Compilers

NVCC := $(CUDA_INSTALL_PATH)/bin/nvcc
CXX := g++
CC := gcc
LINK := g++ -fPIC

which is all I need actually.

Lets analyze the whole concept of the integration and how it works in the common.mk (it might be useful for some people).
The linkline is done by:

LINKLINE = (LINK) -o (TARGET) (OBJS) (LIB)

where :
TARGET := (TARGETDIR)/(EXECUTABLE)
in LINK additional flags are added.

and the most nice part is this :

OBJDIR := (ROOTOBJDIR)/(LIB_ARCH)/(BINSUBDIR) OBJS += (patsubst %.cpp,(OBJDIR)/%.cpp.o,(notdir (CCFILES))) OBJS += (patsubst %.c,(OBJDIR)/%.c.o,(notdir (CFILES))) OBJS += (patsubst %.cu,(OBJDIR)/%.cu.o,(notdir $(CUFILES)))

(OBJDIR)/%.c.o : (SRCDIR)%.c (C_DEPS) (VERBOSE)(CC) (CFLAGS) -o @ -c <

(OBJDIR)/%.cpp.o : (SRCDIR)%.cpp (C_DEPS) (VERBOSE)(CXX) (CXXFLAGS) -o @ -c <

Default arch includes gencode for sm_10, sm_20, and other archs from GENCODE_ARCH declared in the makefile

(OBJDIR)/%.cu.o : (SRCDIR)%.cu (CU_DEPS) (VERBOSE)(NVCC) (GENCODE_SM10) (GENCODE_ARCH) (GENCODE_SM20) (NVCCFLAGS) (SMVERSIONFLAGS) -o @ -c <

So this is exactly what you need for a nice integration of c++ and CUDA. This skeleton of the common file works and is very nice. Setting the right flags provide the necessary libraries etc.

Yet I came here with the question: Are there any IDEs that can do the same thing. For instance click on the cu file and tell it needs to be compiled with nvcc, on cpp and tell it needs to be compiled with g++. Or is this the case that with version 3.0 and up this is not necessary anymore meaning if nvcc can replace g++ since it supports now c++, if so can we speak of 100% replacement of g++ with nvcc? If so I can use netbeans without caring at all else I have to depend on the nicely created common.mk file (with some modifications) but far worse than MS Visual Studio where cpp and cu files can be with a GUI nicely integrated using the right compilers for each case but yet of course a Makefile is far more configurable that MS VS Solution Configuration but you just can’t click on a file in the IDE and expect it to compile with the above script. The IDE has to be AI to match every case of a Makefile. :-). Also a question : can you customize netbeans to do the same thing? I am not just interested for a NVCC environment I am interested in an integrated environment (NVCC + GNU) as you can understand. Or if there is not such a possibility netbeans should build a plugin for this purpose, eitherway I think that they should build it, it can save a lot of people a lot of time.

Please if you reply I would like you to be explicit. So that we do not start a sequence of conversation which someone else can’t follow easily. Since this thread can be useful also for other people.

Best Regards,
Alexander.
P.S:Project : A self configurable IDE according to the Makefile. Irrelevant with the topic but a nice project.

So there is not such an IDE in Linux (or a pluging to an IDE) since I have not received any answer. Such a powerful OS and do not have an IDE that can have this flexibility. I wonder what YDL has to offer. Anyway little do people know about how nicely Graphics are binded with the Nvidia driver. All the application that depend on OpenGL go through the driver to the card and surprise you can have these two results in comparison with Windows. So Linux is faster. I am freatly surprised that there are not applications taking advantage of CUDA like Media Players or games taking advantage of PhysX and OpenGL.

In order to convince you I have a GTX-275 card and a Linux Ubuntu 64bit Server. Take a look on these two comparisons. It is the well-known smoke particles of the CUDA SDK. Take a look at the frame rate between linux and windows. There is no need to say more:

Smoke Particles : Linux 64bit

Smoke Particles : Windows 7 64bit

Best Regards,

Alexander Agathos.

This is what I call a serious CUDA application environment where everything is in your grasp you can plugin your compilers your include files your libraries. A programmable text interface.
Things like this makes you think that you just need good highlighting and an editor like in the background to do your job, everything else in a Makefile. I am a linux from windows programmer and linux is now the default.

Best,
Alexander.