How to Start a New CUDA Project in Visual Studio 2008
Creating a New Project
- Create a new project using the MS wizards, selecting an empty console project.
- Create .cu files for your CUDA code and .c or .cpp files for your host code.
Integrating with CUDA
CUDA Toolkit 3.2 and Later
- Add the NvCudaRuntimeApi.rules file (or NvCudaDriverApi.rules if using the driver API) to the project's Custom Build Rules.
- Add the CUDA runtime library by including $(CUDA_PATH)lib$(PlatformName) in the Additional Library Directories and cudart.lib in the Additional Dependencies.
- Optionally, add $(CUDA_PATH)include to the Additional Include Directories to enable CUDA include file inclusion.
CUDA Toolkit 3.1 and Earlier
- Add the Cuda.rules file to the project's Custom Build Rules.
- Add the CUDA runtime library by including $(CUDA_LIB_PATH) in the Additional Library Directories and cudart.lib in the Additional Dependencies.
- Optionally, add $(CUDA_INC_PATH) to the Additional Include Directories to enable CUDA include file inclusion.
Additional Tips
- Change the Runtime Library to /MT to match the CUDA runtime.
- Enable syntax highlighting using the included usertype.dat file.
- Enable Intellisense support by adding an appropriate registry entry.
- Consider avoiding cutil and creating your own checking mechanisms for enhanced control.
The above is the detailed content of How to Set Up a CUDA Project in Visual Studio 2008?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn