Now lets see if we can integrate a .cpp into our project. Right-click on your project source folder and click add->new item to make a main.cpp file. After you add the .cpp
main.cpp:
#include
int main(int argc, char** argv)
{
printf("Hello World!\n");
int i;
std::cin >> i;
}
When the CUDA SDK is installed it also adds environment variables. Because I am using a 64-bit machine I added additional path variables as discussed in the previous post. In order to use the lib (library) and inc files (header files) from the CUDA SDK you can you can either copy the files from the SDK folders to the toolkit folders such as: $(NVSDKCUDA_ROOT)\common\lib folder to $CUDA\lib or set up paths using the environment variables as follows. Here is how to do it using environment variables.
When the SDK installs, there is an environment variable:
NVSDKCUDA_ROOT
which points to:
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C
From the SDK you will need the library, include files, and binaries (cutil.dll, cutil32D.dll, etc).
Project->Properties->C/C++
$(NVSDKCUDA_ROOT)\common\inc
Project->Properties->Linker->General->Additional Library Directories (field):
$(NVSDKCUDA_ROOT)\common\lib
Your project properties should look like:
Now all you need to do is include the additional input dependent libraries for the linker. For now, we will only include cudart.lib (we will need other libraries later for the linker but for now we are taking it one step at a time).
But in order to compile you will need to include the binaries (dlls) for the linker . To do this I created added the both the debug and release binaries for 32-bit which is my target to the PATH environment variable.
On windows 7
start->right-click on computer->properties->Advanced system settings->Environment Variables->PATH
and add to the end:
;%NVSDKCUDA_ROOT%\bin\Win32\Debug
;%NVSDKCUDA_ROOT%\bin\Win32\Release
Note the semi-colon. There is no semi-colon at the end of the path. The above point to:
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\bin\Win32\Debug
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\bin\Win32\Release
Now you need to restart your system for the SDK dlls to be available to your system.
No comments:
Post a Comment