This is a mirror of official site: http://jasper-net.blogspot.com/

Using CUDA and Thrust with Visual Studio 2010

| Tuesday, March 8, 2011
I was working on setting up some new CUDA projects as I’m doing some spiking (prototyping for the not so agile crowd) work to figure out how best to use CUDA 4.0. I’ve turned it in to a quick tutorial on how to write a simple application that allows you to use both CUDA and the latest C++0x features in Visual Studio 2010.

Because the current CUDA SDK requires projects to compile using the v90 toolset (Visual Studio 2008) the solution requires two projects. One DLL project containing the CUDA and targeting v90 and a second application project targeting v100 (VS 2010) containing the C++ code.

Click on the images to see full size versions.

Installing dependencies

Make sure you have the following installed.
  • Visual Studio 2010 and 2008 SP1 (required by CUDA).
  • Parallel NSight 1.51 
  • CUDA 4.0 RC or 3.2 and Thrust 
If you don’t have 4.0. I built this walkthrough using the 4.0 RC but it should work with 3.2.

Setting up the solution

Create a solution containing two projects. Two projects are required because one targets the V100 (VS 2010) compiler to allow access to the latest C++0x language features and one targets the V90 (VS 2008) compiler because this is required by CUDA.

1) Create a Win32 console application called HelloWorld. Select the defaults for the remaining pages in the wizard. This project will contain the main entry point to your application and any Windows specific code, like the Parallel Patterns Library (PPL) code used for managing threads.

Read more: #2782

Posted via email from Jasper-net

0 comments: