Cuda programming-> introduction to Cuda (1)

Source: Internet
Author: User

Install cuda6.5 + vs2012, the operating system is win8.1 version, first of all the next GPU-Z detected a bit:

It can be seen that this video card is a low-end configuration, the key is to look at two:

Shaders = 384, also known as Sm, or the number of core/stream processors. The larger the number, the more parallel threads are executed, and the larger the computing workload per unit time.

Buswidth = 64bit. The larger the value, the faster the data processing speed.


Next let's take a look at the Cuda layout:

When you see this layout, you will know how to configure it to vs2012, which is similar to opencv, but there are few Chinese materials. Therefore, you need to pay attention to the stuff in the next folder.

When you see this, you will be happy.

Self-learning depends on individuals. My idea is to first learn cuda_runtime_api, cuda_driver_api, cufft_library, and thrust library.

Paste a piece of code:

#include "stdafx.h"#include <iostream>#include <stdio.h> #include "cuda_runtime.h"#include "device_launch_parameters.h"#include "device_functions.h"#include "cuda.h"#include "thrust/host_vector.h"#include "thrust/device_vector.h"#include "thrust/copy.h"#include "thrust/fill.h"#include "thrust/sequence.h"#define  mask_width  3#define  mask_height 3#define width 16using namespace std;


Void Test2 () {// test1 // thrust: host_vector <int> V (4); V [0] = 12; V [1] = 15; V [2] = 34; V [3] = 45; cout <"V size is:" <Endl; cout <v. size () <Endl; For (INT I = 0; I <v. size (); I ++) cout <V [I] <Endl; // Test2 // thrust :: device_vector <int> D (10, 1); thrust: device_vector <int> E (20, 1); thrust: device_vector <int> H (D. begin (), D. end (); // set the value of 7 elements to 9 thrust: Fill (D. begin (), D. begin () +); // set the elements in H to 0, 1, 2, 3, 4, 5 ...... thrust: sequence (H. begin (), H. end (); // copy h to E. // thrust: Copy (H. begin (), H. end (), E. begin); For (INT I = 0; I <H. size (); I ++) cout <H [I] <Endl ;}


int main(){test2();system("pause");return 0;}
The debugging window is as follows:


The specific study of Cuda will be supplemented later ......




Cuda programming-> introduction to Cuda (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.