NVIDIA Nsight Visual Studio Edition 2.2 User Guide > CUDA Debugger > How To > Migrate CUDA SDK Samples

CUDA Toolkit 4.0 includes Visual Studio 2008 projects for all the NVIDIA GPU Computing SDK samples, and many of them also include their Visual Studio 2010 equivalents. However, with CUDA version 3.2, the NVIDIA GPU Computing SDK samples were shipped with only the Visual Studio 2008 projects. This topic covers the approach that can be taken to convert a CUDA SDK sample from Visual Studio 2008 to Visual Studio 2010.

As a specific example, we will be using the Particles VS 2008 project from the NVIDIA GPU Computing SDK 3.2 samples, with the 32-bit debug project configurations:

  1. Open and edit the particles_vc90.vcproj file and remove the old .rules/.props files dependency.
    Remove or comment out the “<DefaultToolFile FileName="NvCudaRuntimeApi.rules"/>” XML tag.



    Save the edited .vcproj file after the editing is completed. 

  2. Open the edited VS 2008 project in VS 2010. The Visual Studio Conversion Wizard will then prompt for this project to be converted. Click through the wizard to convert the project.




  3. Once the conversion wizard has completed, you will see a Conversion Report, which should indicate that the project was converted successfully.



  4. After the project conversion, go to the project Properties > General tab, and select the v90 Platform Toolset.




    The CUDA 3.2 toolkit requires the Microsoft v90 Platform Toolset to build CUDA-based applications. This is because the NVIDIA CUDA Toolkit uses the Microsoft C++ v9.0 compiler (CL.exe) to build CUDA applications. The v90 Platform Toolset does not ship with Visual Studio 2010. For that reason, you need to install the v90 Platform Toolset, and then specify within your project properties that the v90 Platform Toolset be used as the platform toolset for building your CUDA application.

    If you have Visual Studio 2008 SP1 installed, you already have the v90 Platform Toolset. If you do not have Visual Studio 2008 SP1 installed, you need to:

    • Install Visual Studio 2008 SP1 (which requires a license), or 
    • Install Visual C++ 2008 Express Edition with SP1 (which is free).

    You can download the Visual C++ 2008 Express Edition with SP1 from the Microsoft web site. However, do note that cross compiling to 64-bit is not possible with Visual C++ 2008 Express Edition with SP1.


  5. Access the build customization option, either by going to the project context menu in the Solution Explorer, or by selecting the Project menu > Build Customizations.
    Select the CUDA 4.0 build customization file under Build Customizations.




  6. For the CUDA kernel files (*.cu extensions) that are not excluded from the build, right click on these files and navigate to Properties > General tab and select CUDA C/C++ as the Item Type.
    In this example, we need to change the value of the Item Type field for particlesSystem.cu.




    If new .cu files are added to the project after adding the build customization, step 5 would not be required as the Item Type of these newly added .cu files will be set automatically.



  7. Navigate to the project Properties > CUDA C/C++ tab. 
    1. Under the Common sub-tab: 
      • Change the CUDA compiler output filename if required. In this case, we need to change the CUDA compiler output file name to $(IntDir)%(Filename)%(Extension).obj. The reason for changing this is because there is a file named particleSystem.cpp in this project. During the build, there will be a .obj file conflict if we do not change the CUDA compiler output filename to particleSystem.cu.obj.  
      • Specify the additional include directories if required. In this example, we need to specify the following additional include directories: ../../common/inc. 
      • Ensure that the Target Machine Platform field value is set to 32-bit (--machine 32).



Set the Target Machine Platform to 32-bit (--machine 32) for 32-bit project configurations and 64-bit (--machine 64) for 64-bit project configurations.

b.   Under the Host sub-tab: 

  • Change the Runtime Library value to either Multi-Threaded(/MT) for release project configuration, or Multi-Threaded Debug (/MTd) for debug project configuration.
    For this example, we will change the Runtime Library value to Multi-Threaded Debug (/MTd)


8.   The conversion of CUDA Visual Studio 2008 projects to Visual Studio 2010 is now completed, and the project can now be built in VS 2010.

 

 

 

 


NVIDIA® Nsight™ Development Platform, Visual Studio Edition User Guide Rev. 2.2.120522 ©2009-2012. NVIDIA Corporation. All Rights Reserved.