Sunday, April 3, 2011

Setup eclipse for CUDA development

After two weeks playing with Visual Studio, I found that it's very sux, the intellisense is not working all times...maybe I need to install Visual Assist...and for a linux die-hard you'll found eclipse should be more suitable for you.

BTW, here is how to setup eclipse for CUDA development on Windows, although there're several errors
1) Download & install Visual Studio 2005/2008 Express Edition
2) Download & install DirectX SDK
3) Download & install Microsoft Platform SDK
4) Download & install CUDA SDK & Toolkit :-)
5) Download & install eclipse CDT (for sure :p)
6) Download the project template at http://public.procoders.net/cuda_template/minimal_cuda.zip

Now ready to go, create a project using above template, then edit the MAKEFILE change following
Change VC_HOME point to the place that you installed the VC express edition
i.e. VC_HOME= C:\Program Files\Microsoft Visual Studio 9.0\VC
Add SDK_HOME and point to the place that you installed the Platform SDK
i.e. SDK_HOME= C:\Program Files\Microsoft Platform SDK
Change the CUDA_COMMON_HOME point to the location of the CUDA SDK
i.e. CUDA_COMMON_HOME= C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common
Find in the MAKEFILE, the place that set nvcc_par and add -I "$(CUDA_INC_PATH)"
i.e. SET nvcc_par= -I "$(CUDA_INC_PATH)" -I "$(CUDA_COMMON_HOME)\inc" -ccbin "$(CL_EXE)"  \
-Xcompiler $(XCOMPILER_FLAGS) -c $*.cu
The CUDA_INC_PATH is set during the setup of CUDA toolkit
Find the line start with $(LINK_EXE)" and add /LIBPATH:"$(SDK_HOME)\lib"
i.e. "$(LINK_EXE)" /OUT:$(MAIN) /LIBPATH:"$(VC_HOME)\lib" /LIBPATH:"$(SDK_HOME)\lib" $(OBJECTS) \
"$(CUDA_LIB_PATH)\cudart.lib" "$(CUDA_COMMON_HOME)\lib\cutil32.lib"

You will also need to setup the PATH environment variable point to  $(VC_HOME)\BIN before starting eclipse.

Further change is inside the OBJECTS, and MAIN to adapt with your custom project i.e.
OBJECTS= helloWorld.obj
MAIN=helloWorld.exe
Ctrl+B and it will be built :-)
Have fun.

I think I don't need NSight as i'll use cuda-gdb for this feature, that's cool. You might also need to setup eclipse include file to search for CUDA SDK so that the intellisense will work.

BTW, there's a sux thing here, the sal.h get error during the compile inside Eclipse but doing a nmake from console work well. What's happen??!!!  X.X

No comments:

Post a Comment