Friday, March 1, 2013

Running your first CUDA program on Windows 8

Today I bought a new laptop with NVIDIA GeForce GT 660M card, and it came with pre-installed Windows 8. I performed the following steps, and have successfully executed my first small CUDA code.

1. Installed MS Visual Studio (Visual C++) Express 2010 Edition
2. Installed most recent CUDA Toolkit (5.0) from here.
3. Executed the NVidia CUDA samples that came along with the toolkit (as a part of the computing SDK I guess). They executed correctly. However I was not able to compile the corresponding VC projects in VS 2010.
4. So, I followed these steps (and as a part of that wrote a simple and small CUDA code for vector addition within a new VS project). Now my new CUDA code compiled successfully.
5. To allow syntax highlighting for CUDA (.cu) files in VS, I followed these steps. And now, the syntax highlighting (even for CUDA keywords such as BlockIdx) is working fine! :).

Beginning with Parallel Nsight

To download Parallel Nsight Visual Studio edition you need to register on NVidia's developers forum for Parallel Nsight developer profile (after you register for the basic profile first). Then they approve you and you get to download the software. Installation of the software requires Visual Studio 2010 Professional, meaning it does not work with Express editions.

The debug begins

After installing that, then debugging my first program was very straightforward due to the seamless integration of Nsight with Visual Studio. I just set breakpoints at a couple of places within my kernel snippet and then instead of initiating regular VS type debugging, I clicked Nsight->Start CUDA Debugging. However, note that Start CUDA Debugging does not compile the code. You will have to build the project first before clicking Start CUDA Debugging so that your recent changes will be reflected.


No comments:

Post a Comment