ubuntu18+2080ti+cuda10+cudnn7+tf2.0

操作系统

ubuntu18

系统环境准备

#Disable the Nouveau Drivers
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
#Add the following two lines to the file
blacklist nouveau
options nouveau modeset=0
#Regenerate the kernel initramfs
sudo update-initramfs -u
reboot
#sudo apt-get install gcc
sudo apt-get install build-essential

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

安装driver,cuda,cudnn

尝试参考:https://www.jianshu.com/p/d90f5f876de0
安装cuda时同时会自动安装显卡驱动

#安装nvidia驱动
#Link: https://www.nvidia.com/Download/index.aspx

chmod +x NVIDIA-Linux-x86_64-410.78.run
sudo init 3
sudo ./NVIDIA-Linux-x86_64-410.78.run
reboot
nvidia-smi
nvidia-settings


#If there are some troubles, remove the driver, and run the installer:
sudo apt-get remove --purge nvidia*
sudo ./NVIDIA-Linux-x86_64-410.78.run --no-opengl-files




#安装cuda10
#Cuda link: https://developer.nvidia.com/cuda-downloads
#注意选项driver为no,因为已经先装了driver

sudo chmod +x cuda_10.0.130_410.48_linux.run cuda_10.0.130.1_linux.run
sudo sh cuda_10.0.130_410.48_linux.run

-----------------
Do you accept the previously read EULA?
accept/decline/quit:    accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
(y)es/(n)o/(q)uit: no

Install the CUDA 10.0 Toolkit?
(y)es/(n)o/(q)uit: yes

Enter Toolkit Location
 [ default is /usr/local/cuda-10.0 ]:

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: yes

Install the CUDA 10.0 Samples?
(y)es/(n)o/(q)uit: yes

Enter CUDA Samples Location
 [ default is /home/tt01 ]:

Installing the CUDA Toolkit in /usr/local/cuda-10.0 ...
Missing recommended library: libGLU.so
Missing recommended library: libX11.so
Missing recommended library: libXi.so
Missing recommended library: libXmu.so

Installing the CUDA Samples in /home/tt01 ...
Copying samples to /home/tt01/NVIDIA_CUDA-10.0_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Installed in /home/tt01, but missing recommended libraries

Please make sure that
 -   PATH includes /usr/local/cuda-10.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.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-10.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.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 384.00 is required for CUDA 10.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_1987.log
tt01@tt01-virtual-machine:~/nfs/tools/cuda10.0$

sudo sh cuda_10.0.130.1_linux.run

sudo vim ~/.bashrc
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda
source ~/.bashrc

nvcc -V  #检测cuda安装是否正常,显示如下内容即可
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130


#安装cudnn
#cuDNN link: https://developer.nvidia.com/rdp/cudnn-download
sudo dpkg -i libcudnn7*

参考:https://github.com/Tsai-Hyun-Joong/Ubuntu-18.04-RTX-2080-Ti-Driver-cuda-10.0-cudnn-7.0-tensorflow-gpu-Anaconda-Tutorial

问题:偶尔重启系统会丢失显卡驱动

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

#解决方式:重装显卡驱动
sudo init 3
sudo apt-get remove --purge nvidia*
sudo ./NVIDIA-Linux-x86_64-410.78.run --no-opengl-files

anaconda

#Install Anaconda,推荐使用minconda
./Anaconda3-5.3.1-Linux-x86_64.sh
#yes
#回车 
#回车
source ~/.bashrc
conda config --set auto_activate_base false

tensorflow2.0安装

https://github.com/tensorflow/tensorflow

conda update conda
conda create -n tf python=3.6
conda activate tf

#安装numpy
pip install --upgrade pip
pip install -U numpy==1.17.2
conda install pillow
pip install  tensorflow_gpu==2.0.0
#pip install  tensorflow_gpu-2.0.0-cp36-cp36m-manylinux2010_x86_64.whl

#
ERROR: tensorboard 2.0.0 has requirement setuptools>=41.0.0, but you'll have setuptools 36.4.0 which is incompatible.
#重装setuptools
pip install --ignore-installed setuptools==41.0.0   
#重装tensorflow_gpu
pip install --ignore-installed tensorflow_gpu-2.0.0-cp36-cp36m-manylinux2010_x86_64.whl


#解决libcupti问题
find /usr/local/cuda/ -name libcupti.so.10.0
#显示如下
/usr/local/cuda/extras/CUPTI/lib64/libcupti.so.10.0
#然后修改~/.bashrc
sudo vim ~/.bashrc
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}


export CUDA_HOME=/usr/local/cuda
source ~/.bashrc

参考:tensorflow 常见问题(不定期更新)

https://github.com/tensorflow/tensorflow

python
>>> import tensorflow as tf
>>> tf.add(1, 2).numpy()
3
>>> hello = tf.constant('Hello, TensorFlow!')
>>> hello.numpy()
b'Hello, TensorFlow!'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿尔发go

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值