ubuntu14.04 Installation CUDA 7.5/cuda 8.0

Source: Internet
Author: User
Tags documentation cuda toolkit

Translated from: http://blog.csdn.net/masa_fish/article/details/51882183

The installation of CUDA7.5 and CUDA8.0 is a hair-like process. So if you install CUDA8.0, just replace all of the 7.5 below with 8.0.

Toss a lot of days, before and after re-installed probably 六、七次 Ubuntu, finally on the Cuda installed, was the pit several times, also took a lot of detours.
The first post, also please more advice.

Environment
Notebook: ThinkPad T450 x86_64
Video card: Main display Intel HD graphics 5500; NVIDIA GT 940M
System environment: Ubuntu14.04 64-bit, WINDOWS7 64-bit dual system
CUDA version: 7.5
Other: There is no already installed Cuda in Ubuntu

First talk about the big hole you met, after the installation of Cuda always encountered the login interface cycle problem: Enter the password and then jump back to the password input interface . Tried a variety of online statements without solution, and eventually found my problem is out of the dual graphics here. Finally, the answer is found in the official installation documentation.

Problem Solutions:
When you install Cuda, you'll see a prompt asking if you need to install OpenGL Libraries. If your computer is double-displayed and the GPU used to display it is not nvidia, then OpenGL libraries should not be installed, otherwise the OpenGL libraries used by Nvidia's GPU will be overwritten and the GUI will not work.

Let's talk about the experience of installing CUDA.

About Cuda installation, there are a lot of installation posts on the Internet, I also refer to the installation of many. You will find a lot of installation posts on the Web, generally only do more than 10 operations on the finished. But Cuda's official installation documents are very lengthy, there are more than 40 pages, do not think it is nonsense, in fact, are dry.

The installation post on the web is refined because it covers only the necessary installation steps, skipping a number of check operations (for example, checking if the computer has the software that Cuda needs to rely on, whether it has uninstalled software that conflicts with Cuda ), and so on. If you're lucky enough to have something on your computer that you shouldn't have, it's fine, but usually you're not that lucky.

Cuda this thing need to rely on, hold the thing particularly many, if not good inspection, then in the installation time is particularly prone to a variety of conflicts, and once the conflict occurs, even if the uninstall Cuda can not solve the problem, can only reinstall the system.
I ended up with a reference to Cuda's Official document installation successfully.

to summarize, my recommendations for installation are

1) Be sure to the next Cuda official installation documentation, follow its step by step slowly, not lazy .
CUDA 7.5 Official Installation documentation download
2) before installation, be sure to check your system environment and whether the software meets CUDA installation requirements. Do not get lucky and skip the check steps .
3) Check whether the operation was successful for each operation .

Share my installation steps below. The basic and Cuda of the official installation documentation is consistent, different places have special note.

The installation of Cuda is mainly divided into three major segments.
I. Environmental preparation and inspection prior to installation
Second, the installation of Cuda
Third, the installation of the calibration.

1. Install Ubuntu system 14.04

The newly installed 14.04 system will prompt many updates.
There are many posts on the Internet that do not recommend updates, said the update will cause the installation Cuda System interface Circular login issues.
But after I update, I did not encounter any problems.

2. Check whether your computer environment has the condition of installing Cuda

A) Check if your GPU is cuda-capable

Enter: In terminal $ lspci | grep -i nvidia , display your own NVIDIA GPU version information
Go to Cuda's official website to see if your GPU version is in Cuda's support list

b) Check if your Linux version supports CUDA (Ubuntu 14.04 is no problem)

c) Check if GCC is installed in your system

Enter in Terminal: $gcc –version You can view your GCC version information

d) Check if the kernel header and package development are installed

Enter in Terminal: $uname –r You can view your kernel version information
In the terminal, enter: $ sudo apt-get install linux-headers-$(uname -r)
You can install the kernel header and package development for the corresponding kernel version

The above check my computer system to meet the requirements, if not meet the requirements, you can refer to Cuda's official documentation, there is a detailed solution for each problem.

3, choose the installation Method

Cuda offers two ways to install: PackageManager installation and runfile installation
I chose the Package Manager installation, which is relatively simple, but failed several times. Later, the conversion to Runfile installation was successful. Therefore, only the Runfile installation method is described here.

Download Cuda installation package: Cuda official website Download, according to system information select corresponding version, Runfile installation of the last item to select Runfile file

CUDA 7.5 Download Link

PS: Be sure to download to English folder (directory cannot contain Chinese)

4, runfile installation Cuda

A) Disable Nouveau

Run in Terminal: $ lsmod | grep nouveau If there is an output, it means that Nouveau is loading.

(1) Remove this driver directly (back up)

$ mv/lib/modules/4.4.0-31-generic/kernel/drivers/gpu/drm/nouveau/nouveau.ko/lib/modules/ 4.4.0-31-generic/kernel/drivers/gpu/drm/nouveau/nouveau.ko.org

PS: The red part of each version is different, you can CD past to see what version

(2) Reload

$ update-initramfs-u

(3) Restart

You can run the check again to see if it is $ lsmod | grep nouveau disabled successfully, and if there is no output after the run, it will be disabled.

b) Restart the computer, when you reach the login screen, ALT+CTRL+F1, enter the text mode, login account

c) Input $ sudo service lightdm stop close graphical interface

d) switch to the path of the Cuda installation file, run$ sudo sh cuda_7.5.18_linux.run

Follow the prompts to step through the steps

If you are prompted to install OpenGL, select No (if your computer is dual-display like me, and the main display is the non-NVIDIA GPU needs to select No, otherwise Yes)
All others choose Yes or default
After the installation is successful, installedwill be displayed, otherwise the failedwill be displayed.

e) Enter to $ sudo service lightdm start restart the graphical interface.

Alt + Ctrl +f7, return to the graphical login interface, enter the password to log in.
If you are able to log in successfully, you will not encounter a circular logon problem, and the basic instructions for CUDA installation are successful.

f) Restart the computer. Check device Node verification.

Check if /dev there are nvidia* multiple files (device files) named (beginning with nvidia) under the path
If not, you can refer to the guidance steps in the official documentation to add them.

g) Set environment variables.

Input $ sudo gedit /etc/profile in terminal
At the end of the open file, add the following two lines.

Export Path=/usr/local/cuda-7.5/bin: $PATHexport ld_library_path=/usr/local/cuda7.5/lib64

Save the file.

This is a bit different from the official installation documentation, which needs to be explained:

The official documentation says that it is only necessary to run the above two export statements in the terminal, but if you do not write them to the /etc/profile file, such an environment variable disappears after you exit the terminal and does not work, so writing is a permanent practice.

h) Restart the computer to check if the above environment variables are set successfully.

Input in Terminal: $ env
Check the variables set in the output environment variable for the above g), if any, to indicate that the setting is successful.

So far, Cuda's installation is over. For the sake of safety, it is recommended to perform the following checks to ensure the true installation is successful.

5, after the installation of the inspection work.

A) Check that the NVIDIA driver is installed successfully

Terminal input: $ cat /proc/driver/nvidia/version The version number of the NVIDIA driver will be output

b) Check if CUDA Toolkit is installed successfully

Terminal input: $ nvcc –V The version information that will output Cuda

c) Try to compile the example provided by Cuda

Switch to the path where the example is stored, the default path is ~/NVIDIA_CUDA-7.5_Samples
(that /home/xxx/ NVIDIA_CUDA-7.5_Samples is, XXX is your own user name)

Then the terminal enters: $ make

If there is an error, it will stop immediately, otherwise it will start the compilation phase.
My first run with an error message that indicates that there is no GCC in the system
Then make it normal after the terminal runs and $ sudo apt-get install gcc installs GCC.
The entire compile time lasts longer, patiently waiting, about more than 10 minutes is needed.

d) Run compile-generated binaries.

The compiled binaries are stored by default in ~/NVIDIA_CUDA-7.5_Samples/bin中。 the
To switch paths: cd ~/NVIDIA_CUDA-7.5_Samples/bin/x86_64/linux/release
Terminal input:$ ./deviceQuery

Seen similar to the display in the slice, it represents the Cuda installation and the configuration is successful (congratulation!! )

Check the connection of the system and cuda-capable device again.
Terminal input: $ ./sandwidthTest
Seen similar to the display in the slice, it represents a successful

Finally, I wish you all a smooth installation cuda~~

ubuntu14.04 Installation CUDA 7.5/cuda 8.0

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.