View Single Post
Old 02-19-09, 01:54 PM   #12
walterman
Rayne
 
walterman's Avatar
 
Join Date: Oct 2003
Posts: 1,525
Arrow Re: Anybody into CUDA ?

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:


    C++
    General

    • Additional include directories: $(CUDA_INC_PATH);$(NVSDKCUDA_ROOT)\common\inc
    • Debug Information Format: Program Database (/Zi)

    Code Generation

    • Runtime Library: Multi-threaded Debug (/MTd)

    Linker
    General

    • Enable incremental linkin: No (/INCREMENTAL:NO)
    • Additional Library Directories: $(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib

    Input

    • Additional Dependencies: cudart.lib cutil32D.lib

    Optimization

    • 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.
__________________
ASUS Rampage Formula X48 | Xeon 3350 @ 3.6 GHz (450x8/1.26v) | 4x1GB OCZ DDR2 PC2-6400 Reaper CL3 @ 900 MHz 3-4-4-15 | 1 x eVGA GTX 285 SSC | 1 x ASUS EN8800GTX (PhysX/CUDA -> Burnt by nVidia 196.75 driver) | X-Fi Titanium Fatal1ty PCIe | 1 x Intel X25-M G2 80GB | 2 x 750GB WD RE2 7500AYYS SATA2 16MB | Samsung SH-B083L SATA | Enermax Revolution 1250W | Samsung SyncMaster 275T 27" 1920x1200 | Thermaltake Black Armor | BloodRayne 2 FSAA Patch
walterman is offline   Reply With Quote