Finally, i have the whole thing working: VS 2008 + CUDA 2.1.
The setup to create a new project, by hand, is not very easy, and i lost a lot of time trying to compile my first program with success.
This is a quick guide, from my personal experiences:
- Download & Install CUDA 2.1 & the CUDA SDK, from the nVidia site.
- Open VS 2008, and start a new C++ Win32 Console project.
- Right click in the name of the project in the solution explorer, and select 'Custom Build Rules'. A new window will open. Click on 'import' and select the file "C:\CUDA SDK\common\CUDA.rules". Then mark the checkbox for the CUDA files.
- Rename the main .cpp file to .cu
- Right click on the .cu file and select 'properties'. Select 'CUDA Build Rule 2.1.0' in General - Tool.
- Open the properties of the project, and change:
- Additional include directories: $(CUDA_INC_PATH);$(NVSDKCUDA_ROOT)\common\inc
- Debug Information Format: Program Database (/Zi)
- Runtime Library: Multi-threaded Debug (/MTd)
- Enable incremental linkin: No (/INCREMENTAL:NO)
- Additional Library Directories: $(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib
- Additional Dependencies: cudart.lib cutil32D.lib
- Enable COMDAT folding: Do Not Remove Redundant COMDATs (/OPT:NOICF)
Then, edit your .cu file, and put your kernel there.
I tried my perlin code on the GPU, and, atm, it sucks. It's slightly faster than my multi-threaded SSE3 code, and this gfx card has 240 'cores', vs my quad. Obviously, i need to learn some CUDA tricks to speed up my code, because this cannot be so slow.
Also, i still dunno how to debug the CUDA code. It's a pain in the ass atm when something does not work.