Ubuntu14.04 configure Cuda

Source: Internet
Author: User
Tags cuda toolkit

First, I installed ubuntu14.04.1.

1. Pre-Check

Check the system as shown in reference 1.

Run the following command:

:~$ lspci | grep -i nvidia03:00.0 3D controller: NVIDIA Corporation GK110GL [Tesla K20c] (rev a1)04:00.0 VGA compatible controller: NVIDIA Corporation GK106GL [Quadro K4000] (rev a1)04:00.1 Audio device: NVIDIA Corporation GK106 HDMI Audio Controller (rev a1)

Two GPUs, k20 and k4000, and an audio, should be the sound card.

Then, run the command to check the system version:

~$ uname -m && cat /etc/*releasex86_64DISTRIB_ID=UbuntuDISTRIB_RELEASE=14.04DISTRIB_CODENAME=trustyDISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"NAME="Ubuntu"VERSION="14.04.1 LTS, Trusty Tahr"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 14.04.1 LTS"VERSION_ID="14.04"HOME_URL="http://www.ubuntu.com/"SUPPORT_URL="http://help.ubuntu.com/"BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

We can see that the machine version is ubuntu14.04.

Then, use GCC -- version to check whether the GCC version meets the requirements in connection 1:

~$ gcc --versiongcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2Copyright (C) 2013 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

After checking, go to the NVIDIA website (refer to link 3) to download the driver, which is the Deb package of ubuntu14.04.

2. Installation

Deb package installation is relatively simple, but the installation process prompts instability, but there is nothing wrong with it.

Follow the instructions in link 2 to install the necessary libraries.

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

Or follow the process on the official website.

$ sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb$ sudo apt-get update$ sudo apt-get install cuda

It may take a long time to download the file, but it doesn't matter.

If the installation is complete.

Prompt during installation:

*** Please reboot your computer and verify that the nvidia graphics driver is loaded. ****** If the driver fails to load, please use the NVIDIA graphics driver .run installer ****** to get into a stable state.

I'm not sure. I am prompted that the. Run installation is relatively stable, but I am using it now.

3. Configure the environment

My system is 64-bit, so add it to. bashrc When configuring the environment

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

After the environment is configured, execute the command

~$ source .bashrc 

Make it take effect immediately.

4. install sample

After the environment is configured, run the following command:

$ Cuda-install-samples-6.5.sh <dir>

In this way, the Cuda sample is copied to the Dir folder. This command is only a copy operation.

Then enter the folder and execute the make command to compile. The compilation takes a long time and you need to wait.

5. Verify if the installation is successful 5.1. Driver Verification

First, verify that the NVIDIA driver is successfully installed.

~$ cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX x86_64 Kernel Module  340.29  Thu Jul 31 20:23:19 PDT 2014GCC version:  gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 

5.2. Toolkit Verification

Verify that the Cuda toolkit is successful.

~$ nvcc -Vnvcc: NVIDIA (R) Cuda compiler driverCopyright (c) 2005-2014 NVIDIA CorporationBuilt on Thu_Jul_17_21:41:27_CDT_2014Cuda compilation tools, release 6.5, V6.5.12

5.3. device identification

Use the devicequery compiled by Cuda sample for verification. Devicequery is in the <cuda_sample_install_path>/bin/x_86_64/Linux/release directory. My results are as follows: two GPUs are detected.

~/install/NVIDIA_CUDA-6.5_Samples/bin/x86_64/linux/release$ ./deviceQuery./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking)Detected 2 CUDA Capable device(s) Device 0: "Tesla K20c"  CUDA Driver Version / Runtime Version          6.5 / 6.5  CUDA Capability Major/Minor version number:    3.5  Total amount of global memory:                 4800 MBytes (5032706048 bytes)  (13) Multiprocessors, (192) CUDA Cores/MP:     2496 CUDA Cores  GPU Clock rate:                                706 MHz (0.71 GHz)  Memory Clock rate:                             2600 Mhz  Memory Bus Width:                              320-bit  L2 Cache Size:                                 1310720 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 2 copy engine(s)  Run time limit on kernels:                     No  Integrated GPU sharing Host Memory:            No  Support host page-locked memory mapping:       Yes  Alignment requirement for Surfaces:            Yes  Device has ECC support:                        Enabled  Device supports Unified Addressing (UVA):      Yes  Device PCI Bus ID / PCI location ID:           3 / 0  Compute Mode:     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > Device 1: "Quadro K4000"  CUDA Driver Version / Runtime Version          6.5 / 6.5  CUDA Capability Major/Minor version number:    3.0  Total amount of global memory:                 3071 MBytes (3220504576 bytes)  ( 4) Multiprocessors, (192) CUDA Cores/MP:     768 CUDA Cores  GPU Clock rate:                                811 MHz (0.81 GHz)  Memory Clock rate:                             2808 Mhz  Memory Bus Width:                              192-bit  L2 Cache Size:                                 393216 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:           4 / 0  Compute Mode:     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >> Peer access from Tesla K20c (GPU0) -> Quadro K4000 (GPU1) : No> Peer access from Quadro K4000 (GPU1) -> Tesla K20c (GPU0) : No deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 2, Device0 = Tesla K20c, Device1 = Quadro K4000Result = PASS

In this way, the Cuda installation is successful.



Reference

1. http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#axzz3EiJkLjAq

2. http://blog.csdn.net/abcjennifer/article/details/23016583

3. https://developer.nvidia.com/cuda-downloads

 

 

 

 

Ubuntu14.04 configure Cuda

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.