ubuntu16.04+1080ti+cuda10.0+cudnn环境配置及百度云

原地址:https://blog.csdn.net/ding19950107/article/details/89538228

ubuntu16.04+1080ti+cuda10.0+cudnn7.4.2环境配置


本次教程用到的版本号分别是:
NVIDIA–410.78
cuda_10.0.130_410.48_linux.run
cudnn-10.0-linux-x64-v7.4.2.24.tgz(需要自己注册账号登录下载)

网站有时候会打不开所以提供了我自己使用的版本的百度云链接:
cuda10.0
链接:https://pan.baidu.com/s/1Th12td890MSu16XFq5vygQ
提取码:2h94
cuda9.0
链接:https://pan.baidu.com/s/1sKdAkwZpqcc746ZIYWOlbA
提取码:omlb
cudnn7.4.2 (配合cuda10.0)
链接:https://pan.baidu.com/s/1Os5WGpmjJ_xTH16Ch1qcng
提取码:hq5f
cudnn7.5.0(配合cuda9.0)
链接:https://pan.baidu.com/s/1qzG1N-t8CHsH_h9ZZ2jRqQ
提取码:7slq

1.显卡驱动的安装

首先安装ubuntu系统就不做详细介绍了,默认是系统安装完成。
在安装cuda之前,第一步现在ubuntu16.04上安装NVIDIA的驱动,这里要注意:cuda版本要和驱动相对应、cuda版本要和驱动相对应、cuda版本要和驱动相对应(强调三遍)

CUDA Toolkit VersionLinux x86_64 Driver Version
CUDA 10.1>= 418.39
CUDA 10.0>= 410.48
CUDA 9.2>= 396.37
CUDA 9.1>= 390.46
CUDA 9.0>= 384.81
CUDA 8.0>= 375.26
CUDA 7.5>= 352.31
CUDA 7.0>= 346.46

以上表格就是对应cuda和nvidia驱动版本之间的匹配,需要注意的是驱动的>=指的是大于这个版本的驱动,言下之意就是高版本驱动可以兼容安装低版本的cuda,反之则不成立。

1.2驱动安装

简单的几行命令,使用ppa源进行安装ubuntu提供的驱动
sudo add-apt-repository ppa:xorg-edgers/ppa #添加ppa源
sudo add-apt-repository ppa:graphics-drivers/ppa #添加ppa源
sudo apt-get update #更新软件包
ubuntu-drivers devices #选择合适的驱动版本
这里我选择的410版本的,你可以选择更高
sudo apt install nvidia-410

2.cuda10.0安装

cuda10.0安装
1.sudo sh cuda_10.0.130_410.48_linux.run
接下来进入英文选择界面按住空格键可以快速浏览
在安装过程中选项选择:
accept #同意安装
n #不安装Driver,因为已安装驱动**(这里需要强调一下)**
y #安装CUDA Toolkit
#安装到默认目录
y #创建安装目录的软链接
n #不复制Samples,因为在安装目录下有/samples
2.添加环境变量
home文件下 ctrl+H显示隐藏文件 打开 .bashrc文件在最后添加

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export PATH=$PATH:/usr/local/cuda-10.0/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.0

 
 
  • 1
  • 2
  • 3

source ~/.bashrc 保存操作
nvcc --version 检查cuda是否安装成功
在这里插入图片描述
cat /usr/local/cuda/version.txt
查看cuda版本

3.cudnn10.0安装

1.准备好cuda相对应的cudnn文件,将文件解压得到cuda文件夹,在终端中打开cuda文件夹的位置输入以下命令

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

 
 
  • 1
  • 2
  • 3
  • 4

2.查看cudnn版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
输出代码,表示的是安装的7.4.2版本的cudcnn在这里插入图片描述
到此为止,nvidia驱动、cuda10.0和cudnn全部安装成功
如果你安装成功了,可以动动小手点个赞!
#################################################################################
最后运行tensorflow-gpu报错 ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
终端里面执行sudo ln -sf /usr/local/cuda-10.0/lib64/libcudnn.so.7.4.2 /usr/local/cuda-10.0/lib64/libcudnn.so.7 #libcudnn.so.7.4.2和libcudnn.so.7理论上只有一个
最后:sudo ldconfig /usr/local/cuda-10.0/lib64
完成!!!

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
自编译tensorflow: 1.python3.5,tensorflow1.12; 2.支持cuda10.0,cudnn7.3.1,TensorRT-5.0.2.6-cuda10.0-cudnn7.3; 3.支持mkl,无MPI; 软硬件硬件环境:Ubuntu16.04,GeForce GTX 1080 配置信息: hp@dla:~/work/ts_compile/tensorflow$ ./configure WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown". You have bazel 0.19.1 installed. Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3 Found possible Python library paths: /usr/local/lib/python3.5/dist-packages /usr/lib/python3/dist-packages Please input the desired Python library path to use. Default is [/usr/local/lib/python3.5/dist-packages] Do you wish to build TensorFlow with XLA JIT support? [Y/n]: XLA JIT support will be enabled for TensorFlow. Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: No OpenCL SYCL support will be enabled for TensorFlow. Do you wish to build TensorFlow with ROCm support? [y/N]: No ROCm support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: y CUDA support will be enabled for TensorFlow. Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10.0]: Please specify the location where CUDA 10.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-10.0 Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]: 7.3.1 Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-10.0]: Do you wish to build TensorFlow with TensorRT support? [y/N]: y TensorRT support will be enabled for TensorFlow. Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]:/home/hp/bin/TensorRT-5.0.2.6-cuda10.0-cudnn7.3/targets/x86_64-linux-gnu Please specify the locally installed NCCL version you want to use. [Default is to use https://github.com/nvidia/nccl]: Please specify a list of comma-separated Cuda compute capabilities you want to build with. You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 6.1,6.1,6.1]: Do you want to use clang as CUDA compiler? [y/N]: nvcc will be used as CUDA compiler. Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: Do you wish to build TensorFlow with MPI support? [y/N]: No MPI support will be enabled for TensorFlow. Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: Not configuring the WORKSPACE for Android builds. Preconfigured Bazel build configs. You can use any of the below by adding "--config=" to your build command. See .bazelrc for more details. --config=mkl # Build with MKL support. --config=monolithic # Config for mostly static monolithic build. --config=gdr # Build with GDR support. --config=verbs # Build with libverbs support. --config=ngraph # Build with Intel nGraph support. --config=dynamic_kernels # (Experimental) Build kernels into separate shared objects. Preconfigured Bazel build configs to DISABLE default on features: --config=noaws # Disable AWS S3 filesystem support. --config=nogcp # Disable GCP support. --config=nohdfs # Disable HDFS support. --config=noignite # Disable Apacha Ignite support. --config=nokafka # Disable Apache Kafka support. --config=nonccl # Disable NVIDIA NCCL support. Configuration finished 编译: hp@dla:~/work/ts_compile/tensorflow$ bazel build --config=opt --config=mkl --verbose_failures //tensorflow/tools/pip_package:build_pip_package 卸载已有tensorflow: hp@dla:~/temp$ sudo pip3 uninstall tensorflow 安装自己编译的成果: hp@dla:~/temp$ sudo pip3 install tensorflow-1.12.0-cp35-cp35m-linux_x86_64.whl

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值