首页 技术 正文
技术 2022年11月12日
0 收藏 500 点赞 3,130 浏览 2858 个字

ubuntu 16.04 安装 tensorflow-gpu 包括 CUDA ,CUDNN,CONDA

显卡驱动装好了,如图:

英文原文链接:

https://github.com/williamFalcon/tensorflow-gpu-install-ubuntu-16.04

英文内容:

Tensorflow GPU install on ubuntu 16.04

  1. update apt-get
sudo apt-get update
  1. Install apt-get deps
sudo apt-get install openjdk-8-jdk git python-dev python3-dev python-numpy python3-numpy build-essential python-pip python3-pip python-virtualenv swig python-wheel libcurl3-dev
  1. install nvidia drivers
# The 16.04 installer works with 16.10.
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda -y

2a. check nvidia driver install

nvidia-smi   # you should see a list of gpus printed
# if not, the previous steps failed.
  1. install cuda toolkit (MAKE SURE TO SELECT N TO INSTALL NVIDIA DRIVERS)
wget https://s3.amazonaws.com/personal-waf/cuda_8.0.61_375.26_linux.run
sudo sh cuda_8.0.61_375.26_linux.run # press and hold s to skip agreement # Do you accept the previously read EULA?
# accept# Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.62?
# ************************* VERY KEY ****************************
# ******************** DON"T SAY Y ******************************
# n# Install the CUDA 8.0 Toolkit?
# y# Enter Toolkit Location
# press enter# Do you want to install a symbolic link at /usr/local/cuda?
# y# Install the CUDA 8.0 Samples?
# y# Enter CUDA Samples Location
# press enter # now this prints:
# Installing the CUDA Toolkit in /usr/local/cuda-8.0 …
# Installing the CUDA Samples in /home/liping …
# Copying samples to /home/liping/NVIDIA_CUDA-8.0_Samples now…
# Finished copying samples.
  1. Install cudnn
wget https://s3.amazonaws.com/personal-waf/cudnn-8.0-linux-x64-v5.1.tgz
sudo tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz
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 /usr/local/cuda/lib64/libcudnn*
  1. Add these lines to end of ~/.bashrc:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
  1. Reload bashrc
source ~/.bashrc
  1. Install miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh # press s to skip terms # Do you approve the license terms? [yes|no]
# yes# Miniconda3 will now be installed into this location:
# accept the location# Do you wish the installer to prepend the Miniconda3 install location
# to PATH in your /home/ghost/.bashrc ? [yes|no]
# yes
  1. Reload bashrc
source ~/.bashrc
  1. Create conda env to install tf
conda create -n tensorflow# press y a few times
  1. Activate env
source activate tensorflow
  1. Install tensorflow with GPU support for python 3.6
# pip install --ignore-installed --upgrade aTFUrl
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.0-cp36-cp36m-linux_x86_64.whl
  1. Test tf install
# start python shell
python# run test script
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

亲测:http://www.buluo360.com/

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,910
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,435
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,250
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,061
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,693
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,731