CUDA is NVIDIA’s relatively mature API for data parallel GPU computing. I already explained the benefits of CUDA and even showed a simple code example. Now, you surely want to try it out yourself. This guide will explain how to correctly install and configure CUDA on Windows.
0. Make sure your computer can run CUDA
Find out which graphics card your computer has by going to the Run Dialog with Win+R and typing dxdiag. This will open the DirectX properties. Select the Display tab and it will tell you which card you have.
Next, go to NVIDIA’s list of CUDA-enabled products and search for you graphics card on the list. If you find it, you can run CUDA. All GeForce cards in the 8000 series or above in desktops and laptops as well as ION chipsets being used in new netbooks can run CUDA. Tesla and Quadro cards can also run CUDA. Check the list for your particular model just to make sure.
If your computer cannot run CUDA, you can still program and compile your projects in emulation mode, but it will be really slow.
1. Install Visual Studio 2008
If you have 32-bit Windows, you can use Visual C++ 2008 Express Edition, which is free and works great for most projects.
If you have 64-bit Windows, you must use Visual Studio 2008 Professional, as the Express Edition does not compile to 64-bit binaries. If you’re a student, you can probably get it for free at Dreamspark. I’m not sure if Visual Studio 2008 Standard Edition works on 64-bit Windows. Please leave a comment if you can confirm this.
2. Install latest NVIDIA Driver
The driver is what lets you access all of your NVIDIA’s card latest features, including support for CUDA.
Go to NVIDIA’s Driver Download page, select your operating system and graphics card, and download the latest driver.
After installing the driver, you’ll have to restart your computer.
3. Install CUDA Toolkit and SDK
The CUDA Toolkit will let you compile CUDA programs. The CUDA SDK contains sample projects that you can use when starting your own.
Go to NVIDIA’s CUDA Download page and select your OS. Next, download the correct version of the CUDA Toolkit and SDK for your system. Do not download the drivers on this page, you already downloaded the latest ones in the last step.
If you have a laptop, as of this writing the latest compatible version of CUDA is 2.2. Do not download 2.3, it will not work.
If you have a desktop, as of this writing the latest compatible version of CUDA is 2.3.
4. Try out the examples
Run the examples in the CUDA SDK to make sure everything works. In CUDA 2.2, search for NVIDIA CUDA SDK Browser in the Start Menu. In CUDA 2.3, search for NVIDIA GPU Computing SDK Browser. If they work, you have successfully installed the correct CUDA driver.
5. Test your setup by compiling an example
Open the CUDA SDK folder by going to the SDK browser and choosing Files in any of the examples. Go to the src (CUDA 2.3) or projects (CUDA 2.2) folder and then to one example. Open its Visual Studio 9.0 project in Visual C++. Compile it from scratch by choosing Build > Rebuild Solution.
Run it by choosing Debug > Start Without Debugging. If you are able to compile it without error, and it runs successfully, congratulations! You have correctly installed everything you need to develop with CUDA on Windows.
What if it doesn’t work?
If you followed this guide and CUDA still does not work, go back and make sure you installed the correct version of Visual Studio, drivers, toolkit and SDK. If it still does not work, leave a comment bellow and we’ll probably be able to help you. If you had problems installing CUDA but managed to solve them using a different method, also leave a comment sharing your solution.