Saturday, January 15, 2011

How to make a new CUDA project in VS 2010

Update: How to make a new CUDA project in VS 2012

hey CUDA programmers, here a few steps to make a new CUDA project on visual studio 2010 to run the same as we do in visual studio 2008.

I tried it and worked, assuming of course you're already running CUDA, and you have SDK and tools installed...

first you must do this once:
copy files "Cuda.props, Cuda.targets, and Cuda.xml" to:
C:\Program Files\Microsoft Visual Studio 10.0\VC\VCProjectDefaults
special thanks to Ade Miller for the files


then:
1- create a New Project -> C++ Win32 Console Application -> Empty Project

2- mark the project in the Solution Explorer, then select Project menu -> Build Customizations... CUDA 3.2 or whatever version you're using

3- right click the project in the Solution Explorer and select Properties

4- select General and set the Platform Toolset to v90

5- select VC++ Directories and add to Include Directories:
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc

6- select Linker -> General and add to Additional Library Directories:
$(CUDA_PATH)/lib/$(PlatformName);../../common/lib
and
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\lib

7- select Linker -> Input and add to Additional Dependencies:
cudart.lib


8- select Custom Build Step -> General and add to Additional Dependencies:
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc

9- now add your .cu file

your comments are welcomed

4 comments:

  1. Thanks.

    But
    >C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(293,5): error MSB8010: Specified platform toolset (v90) requires Visual Studio 2008. Please make sure that Visual Studio 2008 is installed on the machine.

    Ie necessarily need vs 2008? I have only 2010.

    ReplyDelete
  2. welcome
    I said: "assuming of course you're already running CUDA, and you have SDK and tools installed"
    you still need vs 2008/2005 to run CUDA examples, because nVidia doesn't support vs 2010 yet !!

    ReplyDelete
  3. Hello I would like to ask about cuda...is it possible to use cuda without nvdia grafic card?? because my pc only have internal inter video card..

    ReplyDelete
    Replies
    1. hello Tomas,
      look, the point of using CUDA is to run on its hardware, which is Nvidia's.
      but if you need to run CUDA for development purposes on another hardware, you can search for "CUDA emulator", I'm not sure how sufficient is it, though.

      Delete