To set up CUDA compile environment with VS 2008.
Step 1: Adding Cuda.Rules to your project.
Project > Custom Build Rules...
Click Find Existing...
Select %CUDA_SDK%\C\common\Cuda.Rules
Step 2: Now set up your Include directory, library directory, and Executable directory.
Tools > Options... > Projects and Solutions > VC++ Directories
Select Platform. In my case, x64 was selected.
And select Show directories for: as Include files.
Add following three directories
%CUDA%\include
%CUDA%\include\crt
%CUDA_SDK%\C\common\inc
And select Show directories for: as Library files.
Add following two directories
%CUDA%\lib64
%CUDA_SDK%\C\common\lib
Simillarly, select Excutable files for the dropdown and specify:
%CUDA%\bin64
%CUDA_SDK%\C\bin\win64\EmuDebug
%CUDA_SDK%\C\bin\win64\EmuRelease
Step 3 : Specify the CUDA Runtime and CUTIL64D.lib.
Project > Properties
Select Configuration Properties > Linker > Input
Specify Additional Dependencies as cudart.lib and cutil64D.lib for Debug configuration
Similarly, for Release configuration, specify Additional Dependencies as cudart.lib and cutil64.lib.
Step 4: Set up for CUDA syntax highlighting
Find the CUDA syntax highlighting supporting file :
%CUDA_SDK%\C\doc\syntax_highlighting\visual_studio_8\usertype.dat
Copy this file into
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
Then, configure VS text editor.
Tools > Options > Text Editor > File Extension
combine cu extension with Microsfot Visula C++
Step 5: In order to debug your code, add cutil64D.dll into your PATH environment variable.
You can also do a "Post build" event in VS2008 to copy over the requisite dll files to the target directory where the exe gets generated.
copy "$(NVSDKCUDA_ROOT)\bin\win64\$(ConfigurationName)\*.dll" "$(TargetDir)"
Reference
http://www.programmerfish.com/how-to-run-cuda-on-visual-studio-2008-vs08/
http://forums.nvidia.com/index.php?showtopic=87705&mode=threaded&pid=503328
이 글은 스프링노트에서 작성되었습니다.
'Computer > CUDA' 카테고리의 다른 글
[ML] WSL2 : Install Tensorflow (GPU) (0) | 2022.07.17 |
---|---|
CUDA 3D, 2D data processing. (0) | 2009.12.18 |