Ubuntu14.04 + cuda6.5 + opencv2.4.9 + cuda

Source: Internet
Author: User
Tags gtx
For the first time, I officially wrote a technical blog. First, I exercised my ability to write summaries. Second, I felt ashamed to have read many technical posts but never contributed myself. 1. preparation 1. first, the runtime environment is ubuntu14.04. Therefore, this document assumes that ubuntu14.04 has been installed. In addition, nvidia designed its gpu programming architecture for cuda.

For the first time, I officially wrote a technical blog. First, I exercised my ability to write summaries. Second, I felt ashamed to have read many technical posts but never contributed myself. 1. preparation 1. first, the runtime environment is ubuntu14.04. Therefore, this document assumes that ubuntu14.04 has been installed. In addition, nvidia designed its gpu programming architecture for cuda.

For the first time, I officially wrote a technical blog. First, I exercised my ability to write summaries. Second, I felt ashamed to have read many technical posts but never contributed myself.

1. Prepare

I. First, the runtime environment is ubuntu14.04Therefore, this article assumes that you have installed ubuntu14.04. In addition, nvidia designed its gpu programming architecture for cuda, therefore, to use cuda, you must first ensure that your computer has a nvidia graphics card. In particular, you must have a cuda-supported graphics card. how to view your own video card:

~ $ Lspci | grep VGA

My video card is NVIDIA GT540M series and the result is:

. 0 VGA compatible controller: NVIDIA Corporation gfw.m [GeForce GT 540 M] (rev a1)

This seems to be a small problem. One of my buddies did not notice this problem. As a result, I had to call for food for a long time and found that I could not install it at all, at last, I found out that AMD

2. If you confirm your computer, NVIDIA's graphics card will be able to perform the following work.

1.Go to the NVIDIA website to download the latest version of cuda-6.5. Since the new version of cuda has integrated the cuda-toolkit and cudaSDK, you only need to download one.

Below is the download link for my download:

Http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.14_linux_64.run

2.And download the nvidia graphics card driver.But I don't know why I need to install the driver again. When installing the driver, I need to first uninstall the original driver, completely clear the driver, and then install the new driver, maybe I think too much about it. linux itself does not have the nvidia graphics card driver, but why should I uninstall it and install it again.

In the following example, the graphics card driver link of nvidia_3.40 is displayed. In another post, cuda6.5 seems to be able to support the driver until 3.40, so do not use a later version.

Http://cn.download.nvidia.com/XFree86/Linux-x86_64/340.24/NVIDIA-Linux-x86_64-340.24.run

The preparation is complete.First install the graphics card driver and then install cuda:

2. Install the video card driver. The following is a simple method I have seen:

1. Download the graphics card driver. This step is ready again.

2. Edit blacklist. conf.

Sudo gedit/etc/modprobe. d/blacklist. conf

Add and save the following parts:

Blacklist vga16fb

Blacklist nouveau

Blacklist rivafb

Blacklist nvidiafb

Blacklist rivatv

(There is a line of space here)

3. Delete the previously installed nVidia driver.

Sudo apt-get remove -- purge nvidia-* (Clean Up required)

Sudo apt-get remove -- purge xserver-xorg-video-nouveau

4. Restart your computer.

5. Press Ctrl + Alt + F1 to go to the first Console (+ F7 is back to xservers ).

6. After Entering the user name and password, log on and run the command (numbers cannot be entered on a keypad ):

Sudo/etc/init. d/TPD stop or

Sudo/etc/init. d/lightdm stop

7. enter the driver's folder and install the driver. (here is a tip. You only need to enter the NVIDIA tab key. You can complete all the file names. Do not say that I am too low, I did not know before, of course, you can also change the driver name to simple, you can know ).

Sudo sh NVIDIA-Linux-x86_64-340.24.run

Error: the distribution-provided pre-install script failed! Ignore this and continue the installation;

8. Start the target instance:

Sudo/etc/init. d/TPD restart or

Sudo/etc/init. d/lightdm restart

9. Restart your computer.

Sudo reboot

10. The video card options in the details may be unknown. You can use the following methods:

Sudo apt-get install mesa-utils

When I install sudo/etc/init according to the above method. d/TPD stop or sudo/etc/init. no files are found in d/TPD restart. It may be a system problem. You don't have to worry about it. Use sudo/etc/init in steps 2 and 3. d/lightdm stop and sudo/etc/init. d/lightdm restart.

3. Install cuda, which is also a simple installation method.

1. Install cuda-6.5

Go to the folder where the downloaded cuda-6.5 is located and execute

Sh cuda_6.5.14_linux_64.run

Then, wait patiently for the installation to complete.

2. Configure Environment Variables

Ubuntu environment variable configuration file again ~ /Home/user name /. bashrc or/etc/bash. in bashr or/etc/profile files, the specific difference seems to be global. What is the difference between permissions and scopes? There may be other differences, therefore, you only need to use gedit to open and edit one of them. Here, we will use it for insurance purposes.

Run the following command:

:~ $ Sudo gedit. bashrc

Add at the end of the file ,:

$ Export PATH =/usr/local/cuda-6.5/bin: $ PATH
$ Export LD_LIBRARY_PATH =/usr/local/cuda-6.5/lib64: $ LD_LIBRARY_PATH

My system is 64-bit, so I use lib64. Of course, I will download it again. I forgot to mention it. I should also pay attention to it when downloading the driver for different systems. Otherwise, I will be white-faced,

Then;

~ $ Source. bashrc

Make environment variable configuration effective

3. Compile the sdk sample

The following is not what I do, but what I do is what I do. But if it is not good, I will not post it.

Compile the Sample file after completion. The entire process takes about 10 minutes.

cd /usr/local/cuda-6.5/samplessudo make

After compilation is complete, go to samples/bin/x86_64/linux/release and run deviceQuery in sudo.

sudo ./deviceQuery

If the following video card information appears, the driver and video card are successfully installed:

./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking)Detected 1 CUDA Capable device(s)Device 0: "GeForce GTX 670"  CUDA Driver Version / Runtime Version          6.5 / 6.5  CUDA Capability Major/Minor version number:    3.0  Total amount of global memory:                 4095 MBytes (4294246400 bytes)  ( 7) Multiprocessors, (192) CUDA Cores/MP:     1344 CUDA Cores  GPU Clock rate:                                1098 MHz (1.10 GHz)  Memory Clock rate:                             3105 Mhz  Memory Bus Width:                              256-bit  L2 Cache Size:                                 524288 bytes  Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)  Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers  Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers  Total amount of constant memory:               65536 bytes  Total amount of shared memory per block:       49152 bytes  Total number of registers available per block: 65536  Warp size:                                     32  Maximum number of threads per multiprocessor:  2048  Maximum number of threads per block:           1024  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)  Maximum memory pitch:                          2147483647 bytes  Texture alignment:                             512 bytes  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)  Run time limit on kernels:                     Yes  Integrated GPU sharing Host Memory:            No  Support host page-locked memory mapping:       Yes  Alignment requirement for Surfaces:            Yes  Device has ECC support:                        Disabled  Device supports Unified Addressing (UVA):      Yes  Device PCI Bus ID / PCI location ID:           1 / 0  Compute Mode:     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce GTX 670Result = PASS
Now the installation of cuda6.5 is complete.
There is time to install opencv and cuda-convnet2 Configuration Technology Summary!

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.