Start of CUDA programming in Ubuntu9.04

Source: Internet
Author: User
A while ago, I completed both the ant colony algorithm and the improved K-Means algorithm, and then watched CUDA programming. I read the introduction of CUDA and thought that CUDA would be easy to use after C, in fact, you still need to know some GPU architecture-related knowledge to write a good program. After reading this book "CUDA for GPU high-performance computing", I feel that it is more like a manuscript, and I have sorted out a book from the previous hengduo document, because it is a collection of the wisdom of a large family, the lecture is good, that is, the order is not very good. There is always better than there is, look

A while ago, I completed both the ant colony algorithm and the improved K-Means algorithm, and then watched CUDA programming. I read the introduction of CUDA and thought that CUDA would be easy to use after C, in fact, you still need to know some GPU architecture-related knowledge to write a good program. After reading this book "CUDA for GPU high-performance computing", I feel that it is more like a manuscript, and I have sorted out a book from the previous hengduo document, because it is a collection of the wisdom of a large family, the lecture is good, that is, the order is not very good. There is always better than none. After reading it again, there is still some confidence in CUDA programming. We recommend that you take a look at it first.

Reading a book and writing a program is another thing. I set up the environment in the previous article, but I still don't know how to create a CUDA project and how to start writing a program. Fortunately, CUDA provides an SDK, which contains many instances for our reference. As a result, my first CUDA program starts from here.

The cuda sdk instances are all under the src directory, and each instance has its own directory, such as deviceuery. There is also a Makefile file used for compilation under its directory, this is to compile a single project. Now we compile all the instances. After running sudo make in the root directory of CUDA_SDK Run the compiled executable program in/bin/linux/release to view the result.

This is the running result of deviceQuery:

We believe that we can use these instances to create our own projects. Then there is a template in the instance. cu ,. delete the cpp file and clear the content in the obj directory. This becomes an empty CUDA project. You can write a program under src and modify the compiled file name in Makefie, compile. The generated execution file is in CUDA_SDK_HOME/bin/linux/release.

Related Article

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.