environment:
ubuntu 16.04 64bit
Dual Graphics:
NVIDIA GEFORCE GTX 850M +
Integrated Graphics
Driver:
nvidia 384
Software:
cuda8.0 + cuDNN5.1
First look at the graphics card:
lspci | grep -i nvidia
Install the dedicated graphics driver:
Install the graphics card driver through the software update function that comes with the system, and pay attention to select the official NVIDIA proprietary driver!
System Settings -> Software Update -> Additional Drivers -> Switch to the latest NVIDIA driver
Nvidia graphics card driver:
restart the computer
Disable the nouveau virtual graphics card:
After installation, you need to disable nouveau, create /etc/modprobe.d/blacklist-nouveau.conf, and write:
blacklist new
option new modeset=0
After that sudo update-initramfs -u
Test whether the disable is successful:
lsmod | grep new
#If there is no output, disable it successfully, if not, restart and try again.
Nvidia CUDA 8.0
:
Download CUDA and CUDNN separately,
Shut down the desktop service
sudo service lightdm stop.
This step is crucial for installing the Nvidia driver
Press Ctrl + Alt + F1 to log in in command line mode,
Enter the directory where you downloaded the cuda file and execute:
sudo sh cuda-8.0.44_linux.run --no-opengl-libs
(--no-opengl-libs)
is very important, otherwise it will overwrite the integrated display and cannot log in normally
#When installing dual graphics cards, remember to use no-opegl-libs. I don't know if I want to add this. I haven't tried it.
Installation process: (hint)
Accept EULA conditions
Say NO to installing the NVIDIA driver
Say YES to installing CUDA Toolkit + Driver
Say YES to installing CUDA Samples
Successful installation output:
============ Summary ============Driver:
Not
SelectedToolkit: Installed
in
/usr/local/cuda-
8.0
Samples: Installed
in
/home/textminerPlease make sure that– PATH includes /usr/local/cuda-
8.0
/bin– LD_LIBRARY_PATH includes /usr/local/cuda-
8.0
/lib64,
or
,
add
/usr/local/cuda-
8.0
/lib64
to
/etc/ld.so.conf
and
run ldconfig
as
root
To
uninstall the CUDA Toolkit, run the uninstall script
in
/usr/local/cuda-
8.0
/binPlease see CUDA_Installation_Guide_Linux.pdf
in
/usr/local/cuda-
8.0
/doc/pdf
for
detailed information
on
setting up CUDA.***WARNING: Incomplete installation! This installation did
not
install the CUDA Driver. A driver
of
version at least
361.00
is required for CUDA 8.0 functionality to work.To install the driver using this installer, run the following command, replacing with the name of this run file:sudo .run -silent -driverLogfile is /opt/temp//cuda_install_6583.log
Restart desktop services
$
sudo
service lightdm start
Configuration Environment
Add the following three sentences to sudo
vim /etc/profile:
export LD_LIBRARY_PATH
=
/usr/
local
/cuda
-
8.0
/lib64:/usr/
local
/cuda
-
8.0
/extras/CUPTI/lib64:
$LD_LIBRARY_PATH
export CUDA_HOME
=
/usr/
local
/cuda
-
8.0
export PATH
=
/usr/
local
/cuda
-
8.0
/bin:
$PATH
save and exit,
source /etc/profile 使能环境变量更改
View environment variables:
echo &PATH
Test if the installation is successful
sudo./cuda-samples-linux-7.0.28-19326674.run
cd/usr/local/cuda-8.0/samples
sudo make
After all the compilation is complete, go to samples/bin/x86_64/linux/release, and run deviceQuery under sudo:
sudo ./deviceQuery
1.3.3 Install cudnn
For the specific number, check the value extracted from the download package. Mine are 5.1.10 and 5.0. Otherwise, there will be a wrong path prompt when loading the tensorflow model at the end.
sudo cp -a include/cudnn.h /usr/local/cuda/include/ # Copy header files
cd ./lib64
sudo cp -a lib* /usr/local/cuda/lib64/ #Copy the dynamic link library cd /usr/local/cuda/lib64/
sudo rm -rf libcudnn.so libcudnn.so.5 #Delete the original dynamic file
sudo ln -s libcudnn.so.5.1.10 libcudnn.so.5 #Generate soft connection
sudo ln -s libcudnn.so.5 libcudnn.so #Generate soft link
Install Tensorflow:
If you have installed the cpu-only version of TF before, please uninstall it first:
Install tensorflow directly using pip or pip3
Install its dependencies first
$ sudo apt-get install python-pip python-dev # for Python 2.7
$ sudo apt-get install python3-pip python3-dev # for Python 3.n
sudo pip3 install
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-gpu-1.0.0-cp35-cp35m-linux_x86_64.whl
Or install Tensorflow from source
后续会更新源码安装Tensorlow,因为最新版本的tensorflow已经支持cuda9.0 和 cudnn7.0 因为不知道新环境的稳定性,所以还是使用源码安装适配8.0 和 5.1.10