sudo gcc --version
If the system does not have gcc installed, it will prompt command not found. Install gcc first at this time.
sudo apt-get build-dep gcc
The command apt-get build-dep (packagename) means to install the relevant compilation environment.
sudo apt-get install build-essential
The kernel headers and development packages for the currently running kernel can be installed with:
( uname -r)
Pay attention to download the deb version, 16.04 local version.
The CUDA Toolkit can be installed using either of two different installation mechanisms: distribution-specific packages (RPM and Deb packages), or a distribution-independent package (runfile packages). The distribution-independent package has the advantage of working across a wider set of Linux distributions, but does not update the distribution's native package management system. The distribution-specific packages interface with the distribution's native package management system. It is recommended to use the distribution-specific packages, where possible.
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau options nouveau modeset=0
Can be executed on the command line
sudo sh -c 'echo "blacklist nouveau" >> /etc/modprobe.d/blacklist-nouveau.conf'
sudo sh -c 'echo "options nouveau modeset=0" >> /etc/modprobe.d/blacklist-nouveau.conf'
Regenerate the kernel initramfs:
$ sudo update-initramfs -u
$ sudo reboot
Use command
lsmod | grep nouveau
If there is no output, the shutdown is successful
If it is a non-216 machine, remount the shared folder after restarting
sudo mount -t cifs -o username=ai,password=fs95536! //172.19.62.216/download216 /home/ai/download216
$ sudo dpkg -i cuda-repo-
For example, our
$ sudo dpkg -i /home/ai/download216/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
When installing using the local repo:
$ sudo apt-key add /var/cuda-repo-
For example, here we are
sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda-libraries-9-0
Dependent packages that may be required to install the driver
sudo apt-get update
sudo apt-get install dkms build-essential linux-headers-generic gcc-multilib
install driver
$sudo chmod u+x /home/ai/download216/NVIDIA-Linux-x86_64-390.87.run
$sudo /home/ai/download216/NVIDIA-Linux-x86_64-390.87.run --dkms -s
The following warning can be ignored
WARNING: nvidia-installer was forced to guess the X library path '/usr/lib' and X module path '/usr/lib/xorg/modules'; these paths were not queryable from the system. If X fails to find the NVIDIA X driver module, please install the pkg-config
utility and the X.Org SDK/development package for your distribution and reinstall the driver.
Test the driver after installation
nvidia-smi
If there is information output, the installation is successful
It can be tested without restarting the system
If it is a non-216 machine, remount the shared folder after restarting
sudo mount -t cifs -o username=ai,password=fs95536! //172.19.62.216/download216 /home/ai/download216
The PATH variable needs to include /usr/local/cuda-9.0/bin
To add this path to the PATH variable:
{ PATH:+:${PATH}}
In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-9.0/lib64 on a 64-bit system, or /usr/local/cuda-9.0/lib on a 32-bit system
To change the environment variables for 64-bit operating systems:
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64
{ LD_LIBRARY_PATH}}
The download in the code below for non-216 machines should be changed to download216
sudo dpkg -i /home/ai/download216/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb
sudo dpkg -i /home/ai/download216/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb
sudo dpkg -i /home/ai/download216/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-3_1.0-1_amd64.deb
sudo dpkg -i /home/ai/download216/cuda-repo-ubuntu1604-9-0-176-local-patch-4_1.0-1_amd64.deb
Unzip the installation package of .solitairetheme8, the package with the suffix is all Linux platforms
The download in the code below for non-216 machines should be changed to download216
cp /home/ai/download216/cudnn-9.0-linux-x64-v7.1.solitairetheme8 cudnn-9.0-linux-x64-v7.1.tgz
tar -xzvf cudnn-9.0-linux-x64-v7.1.tgz
Copy the following files into the CUDA Toolkit directory.
sudo cp cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h (not needed for this sentence)
》sudo chmod a+r /usr/local/cuda-9.0/lib64/libcudnn
sudo apt-get install cuda-command-line-tools-9-0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/extras/CUPTI/lib64
sudo bash /home/ai/download216/Anaconda3-5.2.0-Linux-x86_64.sh
Update source
source ~/.bashrc
Upgrade conda to the latest version
sudo chown -R ai:ai /home/ai/anaconda3
conda update -n base conda
Upgrade the installation package to the latest version
conda update --all
conda create -n tensorflow pip python=3.5
source activate tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.6.0-cp35-cp35m-linux_x86_64.whl (Due to network problems, this method is not recommended)
recommend:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --ignore-installed --upgrade tensorflow-gpupip install ipykernel
conda install jupyter notebook
jupyter notebook --generate-config
$ jupyter notebook password Enter password: **** Verify password: **** [NotebookPasswordApp] Wrote hashed password to /home/ai/.jupyter/jupyter_notebook_config.json
Find the following line in jupyter_notebook_config.py, uncomment and modify it.
c.NotebookApp.ip='*' c.NotebookApp.password = u'sha:ce.../home/ai/.jupyter/jupyter_notebook_config.json The content in' c.NotebookApp.open_browser = False c.NotebookApp.port =8888 #You can specify a port by yourself, use the port when accessing
Recommended Posts