Set CUDA Build Rules to Project in Visual Studio

Posted: September 22, 2009 in CUDA
Tags: , ,

Open Visual Studio project
Add .cu file to the project
Right Click on the project.
Select custom build rules.
Select CUDA Build Rule v*.*.*
Click OK.
Now build the project.

NB: Do not forget to add the required header files and lib files to project. Also add the path of the included header files and lib files to the project as normal Visual Studio project.

Comments
  1. Manan says:

    Hi! i am unable to add the rule file and work with CUDA…i am not a computer science student. just want to work with cuda on my laptop.
    can anyone guide me through the linking thing?
    please help me..
    my id is mananpatel11@gmail.com

    • Sijo says:

      Hi

      First you have to find out the cuda build rule from the NVIDIA GPU COMPUTING SDK installation folder. Normal it can be found out by Click Start -> All programs -> NVIDIA

      Corporation -> NVIDIA GPU Computing SDK -> Browse NVIDIA GPU Computing SDK. Then Open the folder named C, inside that open the folder Common. There you can find the CUDA build

      Rules (Cuda.Rules).

      Now go to the place where Visual Studio 2008 has been installed don your system. Normally it came in C:\Program Files\Microsoft Visual Studio 8, when you select the default

      folder during Visual Studio Installation. Then go to the folder VC inside Microsoft Visual Studio 8 folder. From there go to VCProjectDefaults folder

      Copy the Cuda.Rules from GPU computing SDK to the VCProjectDefaults folder.

      Then Restart Visual Studio 2008 IDE if it is open.

      Open Visual Studio project
      Add .cu file to the project
      Right Click on the project.
      Select custom build rules.
      Select CUDA Build Rule v*.*.*
      Click OK.
      Now build the project.

      NB: These are the steps to add the CUDA build rules (Version 2.3) on Windows XP Operating System.

  2. John says:

    Sijo terrific stuff, I wish more people like you were given jobs. You’ve given very simple basic instructions to follow. Even shitty Nvidia couldn’t do that.

    I have been trying for ages trying to overcome the rules issue, but only you have written it in a way I can manage.

    I’ll try it and hopefully now on VS 2008 the SDK samples will work.

Leave a comment