Preface: From the beginning I do not know the graphics card is the GPU (although learning computer, but I really do not know ...) Brain remnants such as I am also drunk, to do all these environments before and after 5 days, the front of the buy video card, installed video card and dual system to see another blog installed video card, dual system, this main record I how to configure the environment behind, although the middle reinstall three times, the installation process is not different.
Base platform: 64-bit,ubuntu14.04
1. Install Nvidia driver (refer to technical article, basic copy Ah, crab crab author ~)
(1) in the official website to download nvidia driver, according to the model of their own choice to download, put in the /home/lvxia/ directory below, I downloaded is nvidia-linux-x86_64-367.27.run.
(2) Shielding open source Drive Nouveau (the original article said "Can not edit the Blacklist.conf,nvidia.run driver can stop other open source drive, but need to restart")
sudo gedit/etc/modprobe.d/blacklist.conf
Add the following content to save
Blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv (there is a line of space)
(3) Delete old nvidia driver
sudo apt-get--purge remove nvidia-*(need to clean up) sudo apt-get--purge Remove Xserver-xorg-video-nouveau
(4) Restart the computer.
(5) Press Ctrl + Alt +f1 (F1~f6 can be) to X-server, Ctrl+alt+f7 is return
(6) Turn off the graphics environment or the driver will not install properly
Enter the user name password to log in, and then type the command to execute (the number cannot be entered with the keypad)
sudo service LIGHTDM stop
The service will appear after successful shutdown:LIGHTDM stop/waiting
(7) Enter the folder where the drive is located, this is/home/lvxia, execute
sudo sh nvidia*.run
The original article link in the sudo sh nvidia.run execution failed, type the user password. After the all the way accept can ~ Error The distribution-provided pre-install script failed! Do not bother to continue the installation. The most important step, the installer asks you whether to use NV's Xconfig file, here a point to choose Yes, otherwise you will not use the NV driver when starting X-window.
At this point, the installation is successful ~
(8) Restart X-window Service
sudo service LIGHTDM start
See if the video card is installed and running
Glxinfo | grep rendering
If "direct Rendering:yes" is displayed, it is installed.
The original technical article wrote another PPA source method, I did not test, do not post ~ ~
2. Installing Theano, CUDA support
Here read a lot of good technical blog, but because no one is completely suitable for my situation, also into a lot of pits, so I myself also record a bar ~
(1) ubuntu-installation-theano+caffe-Super Detailed tutorial
(2) Ubuntu 14.04 System installs Nvidia CUDA7.5 and builds Python theano deep learning development environment
(3) Ubuntu14.04 installation Cuda
Crab Crab Authors ~ ~
2.1 Installing Theano
(1) Pre-installed tools
sudo apt-get install-y python-dev python-pip python-nose gcc g++ git gfortran
(2) Installation of Blas, LAPACK, ATLAS
sudo apt-get install-y libopenblas-dev liblapack-dev Libatlas-base-dev
(3) Installation NumPy
After each step of the installation test for 0 errors, in order to carry out the next ~ ~ Time is very long AH ~
-C ' Import numpy; Numpy.test () '
You can also command Python to enter->import numpy->numpy.test ().
(4) Installation scipy
-C ' Import scipy; Scipy.test () '
(5) Installation Theano
-C ' Import Theano; Theano.test () '
This test encountered the importerror:no module named nose-parameterized Error, which was later executed:
Pip Install nose_parameterized
Again test on the wood has a problem, wait a long time ~ above operation I are Reference blog 2, and then I follow his operation to install Cuda, install LIBGL1-MESA-GLX when the dependency package problem can not solve, reported the following error:
The following packages has unmet dependencies:
Unity-control-center:depends:libcheese-gtk23 (>=3.4.0) but it isn't going to be installed
Depends:libcheese7 (>=3.0.1) but it isn't going to be installed
Maddening error hints, after doing this for a day or two, finally there is no positive solution to this problem, do not update/update system patches, do not change/change the source of the software is not, obviously has installed a dependent package, but the total prompt package is not installed, and finally through another blog introduction of the method to install Cuda.
2.2 Installation Cuda (see blog 3)
(1) Verify that the computer has video card support
Lspci | Grep-i nvidia
I bought the GTX 960, the poor version ...
(2) View version of Linux
Uname-m && cat/etc/*release
(3) View GCC version
GCC--version
(4) Download the NVIDIA Cuda Warehouse installation package Nvidia-cuda and find the corresponding version of your computer's corresponding system.
Note that the Deb (network) is selected.
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/ Cuda-repo-ubuntu1404_7.5-18_amd64.deb
Download directly to the home directory ~ ~
(5) Cuda package Installation
sudo dpkg-i cuda-repo-ubuntu1404_7.5-18_amd64.deb
(6) Update the Local warehouse
sudo apt-get update
(7) Install Cuda
sudo apt-get install Cuda
The original technology blog said that the Ubuntu system is installed, do not update the system patches, for reasons see blog 3.
(8) test
Echo ' Export path=/usr/local/cuda-7.5/bin: $PATH ' >> ~/' export ld_library_path=/usr/local/cuda-7.5/ LIB64: $LD _library_path ' >> ~/~/.BASHRC
It is better to restart the computer here, because I follow the operation of the Test devicequery when the start is wrong, restart the computer is good ~
2.3 Verification
(1) View the version of the NVCC compiler
Nvcc-v I
(2) View the driver version of the video card
Cat/proc/driver/nvidia/version
(3) Sample code for CUDA installation
Cuda-install-samples-7.5.sh/home/lvxia/cuda
(4) Compile Code
CD cuda/nvidia_cuda-7.5_samples/ make
(5) running the code
CD bin/x86_64/linux/release/sudo. /Devicequerysudo. /bandwidthtest
The last line of Result=pass means through ~
3. Verifying the Environment
(1) Create a new test.py, copy the following content to save, (/home/lvxia under the main directory)
From TheanoImportfunction, config, shared, sandboxImportTheano.tensor as TImportNumPyImportTime Vlen= 10 * 30 * 768 # 10x #cores x # threads per coreiters= 1000rng= Numpy.random.RandomState (22) x=Shared (Numpy.asarray (Rng.rand (Vlen), config.floatx)) F=function ([], T.exp (x)) print (F.maker.fgraph.toposort ()) T0=time.time () fori in Xrange (iters): R=f () T1=time.time () print ("Looping%d times took%f seconds"% (iters, T1-t0)) Print ("Result is%s"%(R,))ifNumpy.any ([Isinstance (X.op, T.elemwise) forx in F.maker.fgraph.toposort ()]): Print (' used the CPU ')Else: Print (' used the GPU ')
(2) New. THEANORC set GPU instead of CPU operation (home directory)
You can use Gedit to open, because VI is not very operational. Copy the following contents to the file to save. This file is not visible in the home directory, can be seen through the command Ls–all ~
[Global]floatx=float32device=gpu
(3) Running test.py
Python test.py
The last line shows used the GPU is right ~
Then there is a hint cnmem is disabled, CuDNN not available, the data said Cnmem can be used without the tube, Theano support CuDNN (optional), but TensorFlow must CuDNN, so it installed CuDNN.
(4) Installation Cudnn
CUDNN is a set of GPU acceleration solutions specifically designed for deep learning frameworks that need to be registered before you can download CUDNN.
Enter the downloads directory
Tar xvzf cudnn-7.5-linux-x64-v5.0-ga.tgzsudo cp cuda/include/cudnn.h/usr/local/cuda/-a cuda/lib64 /libcudnn* /usr/local/cuda/lib64sudo chmod a+r/usr/local/cuda/lib64/libcudnn*
There's a technical blog that says I don't have a problem here.
Run test.py again, hint Cnmem is disabled, CuDNN 5005 right ~!
Later found some good blog, no test, post it to see the use of GPU and Theano accelerated deep learning, Theano, lasagne, tensorflow in Ubuntu support GPU installation
end,happy~
Hard five days: ubuntu14.04+ graphics driver +cuda+theano Environment installation process