准备:
- L4T 27.1 an Ubuntu 16.04 64-bit variant (aarch64)
- CUDA 8.0
- cuDNN 5.1.10
- TensorFlow安装需要用到CUDA和cuDNN
- 安装的版本为:TensorFlow v1.0.1
增加Swap交换区的大小:
//创建脚本
$ mkdir ~/swap/
$ cd ~/swap/
$ vim createSwapFile.sh
//脚本内容如下
#!/bin/bash
#NVIDIA Jetson TX1 in 3D card
#Create a swapfile for Ubuntu at the current directory location
fallocate -l 4G swapfile
#List out the file
ls -lh swapfile
# Change permissions so that only root can use it
chmod 600 swapfile
#List out the file
ls -lh swapfile
#Set up the Linux swap area
mkswap swapfile
#Now start using the swapfile
swapon swapfile
#Show that it's now being used
swapon -s
//设置权限
$ chmod +x createSwapFile.sh
//执行
$ sudo ./createSwapFile.sh
//创建swap为4G大小swap文件。
//设置开机生效
$ sudo vim /etc/fstab
//内容如下
/home/ubuntu/swap/swapfile none swap sw 0 0
安装:
//下载脚本:
$ mkdir ~/tensorflow
$ cd ~/tensorflow
$ git clone https://github.com/ncnynl/installTensorFlowTX2.git
$ cd installTensorFlowTX2
//安装依赖:
//安装java,Protobuf,grpc-java ,Bazel等
$ chmod +x installPrerequisites.sh
$ ./installPrerequisites.sh
//下载tensorflow代码:
$ ./cloneTensorFlow.sh
//设置环境变量:
$ ./setTensorFlowEV.sh
//编译TensorFlow:
$ ./buildTensorFlow.sh
$ ./packageTensorFlow.sh
//安装whl文件:
$ pip install $HOME/tensorflow-1.0.1-cp27-cp27mu-linux_aarch64.whl
测试:
$ cd $HOME/tensorflow
$ time python tensorflow/models/image/mnist/convolutional.py