Setup your machine to use CUDA
Note that system paths shown in this tutorial might vary a bit, from system to system. Also, administrator rights are required to complete this setup.
1. Open the Device Manager within Windows, and expand the Display adapters tree:
2.
Ensure your device within Display
adapters is one of the following CUDA-capable GPUs:
http://www.nvidia.com/object/cuda_learn_products.html
If you don’t have one, we recommend buying a GeForce 200-series if money
is not an issue and you aim for highest performance. But if your goal is
only to learn CUDA, just pick up an inexpensive GeForce 9000-series.
3. Install Microsoft Visual Studio 2005, which is the development environment you will be using. It can be obtained from the MSDN Academic Alliance Software Center. Install it using default Visual C++ settings.
4. Download and install the following NVIDIA-specific items, from: http://www.nvidia.com/object/cuda_get.html
a. Display driver
b. Toolkit
c. SDK code samples
5. Reboot the computer.
6.
To verify that Visual Studio can now
compile CUDA-specific projects, use Windows Explorer to browse to:
C:\Program Files (x86)\NVIDIA Corporation\NVIDIA CUDA SDK\projects\matrixMul\
7. Double click on matrixMul.sln, which should bring up Visual Studio and load that CUDA project. If this is the first time opening Visual Studio, you may be asked to choose what the default development environment will be, so choose Visual C++.
8. Within Visual Studio, select Win32 from the drop-down below if you are running a 32-bit OS, or x64 if you are running a 64-bit OS.
9. To compile the project, click on Build --> Build Solution. Visual Studio’s output window should look similar to the one below, reporting success.
10. To run the program, click on Debug --> Start Without Debugging. A console window should appear with contents similar to this one:
11. Congratulations. You just set up your machine as a CUDA-enabled development environment and validated its installation.
Setup the environment
1. CUDA-specific syntax highlighting
By default, Visual Studio does not recognize CUDA source files (.cu extension), and therefore shows no syntax highlighting. Fortunately, it is possible to obtain syntax coloring when working on CUDA code by following these steps:
1. Close Visual Studio if it is open.
2.
Open Windows Explorer and browse to:
C:\Program Files (x86)\NVIDIA Corporation\NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8\
3.
Copy the usertype.dat file to:
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\
4. Start Visual Studio, and go to Tools --> Options --> Text Editor --> File Extension.
5. Add a .cu extension to the list, as shown below. Make sure you select Microsoft Visual C++ from the Editor drop-down.
6. Press OK, and restart Visual Studio.
7. You're done! Opening a .cu file should now show syntax highlighting, including for CUDA-specific types, specifiers, etc.
2. Copy required DLLs
1.
Open Windows Explorer and browse to:
C:\Program Files (x86)\NVIDIA
Corporation\NVIDIA CUDA SDK\bin\
2.
From each subfolder, copy all files named
“cutil” with a .dll extension to:
C:\Windows\System32\
3. Install the CUDA Visual Studio Wizard
1.
Download the appropriate release of the
CUDA Visual Studio Wizard. There are 32-bit and 64-bit flavors:
http://sourceforge.net/projects/cudavswizard/
2. Run the executable to install the wizard.
Note: This wizard is a 3rd party add-on and not supported by
NVIDIA.