Recently there are new projects to do, this time is about CUDA---multicore high-performance computing problems, so recently has been learning Cuda programming problems, yesterday installed the software completed, run the first program when still encountered many problems. So here to share with you, with me as a beginner cuda comrades come together.
There are four types of software you need to install:
Of these, Cuda Devdriver is not installed, of course, you can download the latest version of the installation.
Then the download, note that you download all the software and the VS on your computer to match the number of bits, for example, my laptop is 64-bit, VS is also 64-bit, so I downloaded the software is 64-bit. (If the version does not match, wait until the compile time will have a very big problem)
Cuda Download:
Http://developer.nvidia.com/object/cuda_3_0_downloads.html
CUDA VS Wizard Download:
http://sourceforge.net/projects/cudavswizard/
Don't forget to remember your installation path, I was installed by default, my installation path is as follows:
CUDA toolkit:c:\program files\nvidia GPU Computing Toolkit
CUDA Driver:d:\nvidia\displaydriver
CUDA sdk:c:\programdata\nvidia corporation\nvidia GPU Computing SDK 4.0
The SDK is a collection of examples, wait until you write the program to see the example, run it, can also be used to detect whether your programming environment is good.
Make sure your software and vs both are the same number of digits (both 32-bit, or 64-bit), after successful installation, open vs (I'm using VS2005), new project-project type see the following new language types in the project:
Run template
Your first small program to test your CUDA environment for success
Open the installation path of your SDK-"c->src, my: C:\ProgramData\NVIDIA corporation\nvidia GPU Computing SDK 3.2\c\src\template Src folder are some examples that can be run, first open the template this folder, double-click Open this example:
In the VS Project Explorer, you can see a. cu file, but the key words in that file are not highlighted, so what do you do?
Syntax highlighting
There are visual_studio_7 and visual_studio_8 under the Nvdia CUDA sdk\doc\syntax_highlighting file, each containing a highlight for VS.NET/7 and Vs.net 2005/vs 8
1, copy the%nvidia GPU Computing sdk%\c\doc\syntax_highlighting\visual_studio_8 under the NVIDIA-written syntax file usertype.dat to%visua Studio Under the%\common7\ide;
2. Start Visual Studio, choose Tools > Options > Text editor > File extension, set the extension to CU, select Microsoft Visual C + +, and click OK;
3. Restart Visual Studio.
Adding a compilation rule
Using Cuda VS Wizard
CUDA VS Wizard is an open source, Visual Studio-oriented tool written by Openhero. After the installation is complete, the Cudawinapp template will appear when you create a new project in Visual Studio, and creating a project from this template can save many settings;
1. Adding compilation rules
In Solution Explorer, find the project template you just opened, right click on the project, click Properties
Add "Cudart.lib cutil64D.lib" in Properties > Linker > Input > Additional dependencies. (If you are adding Cudart.lib cutil32D.lib with a 32-bit machine)
Note that if you are a 64-bit software classmate, be sure to put debug options on the ditch *64
2 Add additional file rules:
(1). Find Cuda.rules in the nvidia CUDA Sdk\common directory (this is not the same as the software installed by everyone,
If it's a version after 3.2
Default is on C:\Program files\nvidia GPU Computing toolkit\cuda\v3.2\extras\visual_studio_integration\rules)
(2). Open the VS environment, click Tools→options→projects and Solutions→vc++project Settings, add *.cu in C + + File extensions, extensions to Add *.cuh in the Include, add ~nvidia CUDA sdk\common in rule file Search paths, which is the directory where the Cuda.rules files are located.
(3). Restart vs.
After the configuration is complete, double-click the CPP file and click Compile to run.
Get the following running result, which means the configuration is successful
VS's support for CUDA programming is not enough, so many places need to be configured on their own and search for solutions when problems are encountered.
For more information, please click here:
Cuda zone:http://cuda.it168.com/
Cuda Forum:http://cudabbs.it168.com/
Cuda installation and configuration: Windows 7 64-bit environment