学习Tensorflow,使用源码安装
来源:互联网 发布:wifi密码破解软件排行 编辑:程序博客网 时间:2024/05/01 15:54
PC上装好Ubuntu系统,我们一步一步来讲解如何使用源码安装tensorflow?(我的Ubuntu系统是15.10)
- 安装cuda
根据你的系统型号选择相应的cuda版本下载
https://developer.nvidia.com/cuda-downloads
我选的是cuda-repo-ubuntu1504-7-5-local_7.5-18_amd64.deb
右击下载到的文件,Open inTerminal,输入一下命令:
sudo dpkg -icuda-repo-ubuntu1504-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
安装到:/usr/local/cuda
下载cudnn,https://developer.nvidia.com/cudnn
我下的版本是cudnn-7.0-linux-x64-v4.0-prod.tgz
同上,输入以下命令:
tar xvzf cudnn-7.0-linux-x64-v4.0-prod.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/lib64/libcudnn*
- 安装tensorflow
下载tensorflow源文件
git clone--recurse-submodules https://github.com/tensorflow/tensorflow
安装Bazel,Bazel是Google开源构建工具,类似于Make的工具,用来编译构建tensorflow
http://bazel.io/docs/install.html
Bazel下载地址:
https://github.com/bazelbuild/bazel/releases(bazel-0.2.2b-installer-linux-x86_64.sh)
sudo apt-get install pkg-config zip g++zlib1g-dev unzip
chmod +x bazel-version-installer-os.sh
./bazel-version-installer-os.sh --user
export PATH="$PATH:$HOME/bin"
安装tensorflow其他的依赖
sudo apt-get install python-numpy swig python-dev python-wheel
配置tensorflow,需要你指定相应文件的安装目录。cd进tensorflow源文件。
sudo ./configure
配置好,会出现以下内容:
Setting up Cuda include
Setting up Cuda lib64
Setting up Cuda bin
Setting up Cuda nvvm
Setting up CUPTI include
Setting up CUPTI lib64
Configuration finished
使用Bazel编译构建
bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
bazel-bin/tensorflow/cc/tutorials_example_trainer--use_gpu
# Lots of output. This tutorial iteratively calculates the major eigenvalue of# a 2x2 matrix, on GPU. The last few lines look like this.000009/000005 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]000006/000001 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]000009/000009 lambda = 2.000000 x = [0.894427 -0.447214] y = [1.788854 -0.894427]OK!
Test:
cd /home/lei/tensorflow/tensorflow/models/image/mnist
python convolutional.py
Tips:
- configure, gcc version <=4.9
- cudnn version = v4
参考资料:
- Installing from sources
- one problem
- 学习Tensorflow,使用源码安装
- TensorFlow学习一:源码安装
- TensorFlow学习:安装和使用
- 转: TensorFlow学习一:源码安装
- Ubuntu 16.04 Tensorflow 使用源码安装
- TensorFlow学习笔记(一):快速安装与使用TensorFlow
- TensorFlow学习笔记(一补):使用Anaconda安装TensorFlow
- TensorFlow学习笔记(一):快速安装与使用TensorFlow
- TensorFlow学习笔记01:Win10下使用Anaconda安装TensorFlow
- tensorflow源码安装
- Tensorflow源码安装
- tensorflow源码安装
- Tensorflow源码安装
- tensorflow源码安装
- 服务器源码安装TensorFlow
- mac源码安装tensorflow
- 源码安装tensorflow
- ubuntu源码安装tensorflow
- 第一章 伟大软件
- 安装google perftools
- 阿里云虚拟主机建立wordpress站点时数据库创建失败问题
- 7.1 S3方法
- Java的类加载
- 学习Tensorflow,使用源码安装
- php实现excel导入数据
- iOS程序猿之JSONKit的使用
- Mybatis学习与总结
- Opencv简单编程--Mat图像作为函数参数
- 【BZOJ1101】【POI2007】Zap
- 关于TCP三次握手链接,四次握手关闭
- ed2k 网络中搜索资源并选择资源下载的分析及eMule源码梳理
- Android之Fragment