ubuntu17.10 installation Cuda

Source: Internet
Author: User

1. Update Apt-get Source list

sudo apt-get update sudo apt-get Upgrade

2. Add a drive source
sudo add-apt-repository ppa:graphics-drivers/ppasudo apt-get update
3. Install NVIDIA driver 1. Normal policy
sudo apt-get install nvidia-367sudo apt-get install mesa-common-devsudo apt -Get install Freeglut3-dev

This step has a lot of pits, if you're lucky enough. The above steps are completed and restarted. Perform:

sudo lshw-c video|rep configuration

If the Nvidia typeface is displayed, it will be installed on behalf of the driver. Go straight to step 4th. If it is nouveau or other, it is not installed, please see below.

2. Pit-Stepping strategy

Don't ask me what 367 is, is said to be the graphics card version number or something, I see the download, actually downloaded several versions, more than 367 higher than a lot. The reason is superficial understanding because the above operation is said to have a high probability of success. However, I have obsessive-compulsive disorder, I chose to go to the official website to download the corresponding driver of my graphics card, manually installed, and then all the way out of the pit countless, fortunately, finally succeeded.

2.1 First, disable Nouveau.

Nouveau is the system comes with universal driver, generally support your graphics card, my gtx1070 all support (then why do I update the official driver?) There may be obsessive compulsive disorder! In fact, I was worried about not being able to fully mobilize the performance of my graphics card, affecting the data set training of deep learn behind me. The method is brute force removal:

mv/lib/modules/3.0.0-12-generic/kernel/drivers/gpu/drm/nouveau/nouveau.ko/lib/modules/3.0.0-12-generic/kernel/ Drivers/gpu/drm/nouveau/nouveau.ko.bak

Reboot to test the success of the previous normal policy driver again. If it succeeds, take the 4th step.

2.2 Download Official website driver

To obtain hardware information for the video card:

Lspci-vnn | grep vga-a 12

Then take the model, go to the official website to download. It looks like you need to register an account.

2.3 Close X Service

Linux releases, there is a common system operating level. 3 is the standard multi-user mode, and 5 is the X Window mode. You can use the RunLevel command to view the current system run level. ubuntu17.10 Desktop Edition, the default level is 5. We can switch the run mode through the Telinit command.

sudo telinit 3

Enter command-line mode. If you want to enter X windows, change 3 to 5.

2.4 Installation

Download the file on the official website, the suffix should be bundle. Assign Execute permissions:

sudo chmod +x $name
sudo./$name

Reboot. View drivers.

4. Installing Cuda

(You also need to register first): Https://developer.nvidia.com/cuda-release-candidate-download

1. Run format file

If you are downloading the run file, you can run it directly.

2. deb format File 2.1 install GCC:
sudo apt-get install gcc-5

Note Be sure to select a good version, do not select the default Mount Gcc-7, and later compile does not support the version of GCC greater than 6.

When I install, the first method fails, and now I think it may be because the GCC version is not supported.

2.2 Installing the kernel header file
sudo apt-get install linux-headers-$ (uname-r)
2.3 Deb Installation
sudo dpkg-i cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64.debsudo apt-key add/var/cuda-repo-<version>/ 7fa2af80.pub  <version> Part is the version that you download, usually press the TAB key in the command line to be able to come out;
sudo apt-get updatesudo apt-get install Cuda
2.4 Adding environment variables

Write to the end of the ~/.BASHRC:

Export Path=/usr/local/cuda-9.0/bin\${path:+:\${path}}export Ld_library_path=/usr/local/cuda-9.0/lib64\${ld_ Library_path:+:\${ld_library_path}}
2.5 Testing
cuda-install-samples-9.0.sh <dir>  Installation test program,<dir> is the installation directory, you can create a new

After installing the,<dir> there is a Nvidia_cuda-9.0_samples folder, CD into this folder inside, execute $sudo make, after compiling, In the bin directory or subdirectory of the bin directory in the subdirectory of the compiled devicequery executable file, execute this file, you can see the following output to indicate that the installation was successful:

If the execution fails, the graphics driver is not installed properly.

Finally, let's Test Cuda and run:

sudo nvidia-smi

You can see various information about the GPU.

5. Installing CUDNN

Download: https://developer.nvidia.com/rdp/cudnn-download

TAR-XZVF Cudnn-9.0-linux-x64-v7.tgzsudo CP cuda/include/cudnn.h/usr/local/cuda/includesudo CP cuda/lib64/libcudnn*/ Usr/local/cuda/lib64sudo chmod a+r/usr/local/cuda/include/cudnn.hsudo chmod a+r/usr/local/cuda/lib64/libcudnn*

 

ubuntu17.10 installation 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.