-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
594db37
commit 8f2357f
Showing
14 changed files
with
249 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,109 @@ | ||
# installTensorFlowTX2 | ||
April 1, 2017 | ||
Install TensorFlow v1.0.1 on NVIDIA Jetson TX2 Development Kit | ||
September 11, 2017 | ||
JetsonHacks | ||
|
||
Jetson TX2 is flashed with JetPack 3.0 which installs: | ||
* L4T 27.1 an Ubuntu 16.04 64-bit variant (aarch64) | ||
Install TensorFlow v1.3 on NVIDIA Jetson TX2 Development Kit | ||
|
||
Jetson TX2 is flashed with JetPack 3.1 which installs: | ||
* L4T 28.1 an Ubuntu 16.04 64-bit variant (aarch64) | ||
* CUDA 8.0 | ||
* cuDNN 5.1.10 | ||
* cuDNN 6.0 | ||
|
||
### Installation | ||
Before installing TensorFlow, a swap file should be created (minimum of 8GB recommended). The Jetson TX2 does not have enough physical memory to compile TensorFlow. The swap file may be located on the internal eMMC, and may be removed after the build. | ||
|
||
Note: This procedure was derived from these discussion threads: | ||
There is a convenience script for building a swap file. To build a 8GB swapfile on the eMMC in the home directory: | ||
|
||
$ ./createSwapfile.sh -d ~/ -s 8 | ||
|
||
After TensorFlow has finished building, the swap file is no longer needed and may be removed. | ||
|
||
<ul> | ||
<li>https://github.com/tensorflow/tensorflow/issues/851</li> | ||
<li>http://stackoverflow.com/questions/39783919/tensorflow-on-nvidia-tx1/</li> | ||
<li>https://devtalk.nvidia.com/default/topic/1000717/tensorflow-on-jetson-tx2/</li> | ||
</ul> | ||
|
||
These scripts support either Python 2.7 or Python 3.5. | ||
TensorFlow should be built in the following order: | ||
|
||
#### installPrerequisites.sh | ||
Installs Java and other dependencies needed. Also builds: | ||
## For Python 2.7 | ||
|
||
##### Bazel | ||
Builds version 0.4.5. Includes patches for compiling under aarch64. | ||
#### installPrerequisites.sh | ||
Installs Java and other dependencies needed. Also builds Bazel version 0.5.2. | ||
|
||
#### cloneTensorFlow.sh | ||
Git clones v1.0.1 from the TensorFlow repository and patches the source code for aarch64 | ||
Git clones v1.3.0 from the TensorFlow repository and patches the source code for aarch64 | ||
|
||
#### setTensorFlowEV.sh | ||
Sets up the TensorFlow environment variables. This script will ask for the default python library path. There are many settings to chose from, the script picks the usual suspects. Uses python 2.7. | ||
|
||
## For Python 3.5 | ||
|
||
#### installPrerequisitesPy3.sh | ||
Installs Java and other dependencies needed. Also builds Bazel version 0.5.2. | ||
|
||
#### cloneTensorFlow.sh | ||
Git clones v1.3.0 from the TensorFlow repository and patches the source code for aarch64 | ||
|
||
#### setTensorFlowEVPy3.sh | ||
Sets up the TensorFlow environment variables. This script will ask for the default python library path. There are many settings to chose from, the script picks the usual suspects. Uses python 3.5. | ||
|
||
## Build TensorFlow | ||
Once the prerequisites have been installed and the environment configured, it is time to build TensorFlow itself. | ||
|
||
#### buildTensorFlow.sh | ||
Builds TensorFlow. | ||
|
||
#### packageTensorFlow.sh | ||
Once TensorFlow has finished building, this script may be used to create a 'wheel' file, a package for installing with Python. The wheel file will be in the $HOME directory. | ||
|
||
#### Install wheel file | ||
For Python 2.X | ||
|
||
$ pip install $HOME/<em>wheel file</em> | ||
|
||
For Python 3.X | ||
|
||
$ pip3 install $HOME/<em>wheel file</em> | ||
|
||
|
||
### Notes | ||
This TensorFlow installation procedure was derived from these discussion threads: | ||
|
||
<ul> | ||
<li>https://github.com/tensorflow/tensorflow/issues/851</li> | ||
<li>http://stackoverflow.com/questions/39783919/tensorflow-on-nvidia-tx1/</li> | ||
<li>https://devtalk.nvidia.com/default/topic/1000717/tensorflow-on-jetson-tx2/</li> | ||
<li>https://github.com/tensorflow/tensorflow/issues/9697</li> | ||
</ul> | ||
|
||
### Release Notes | ||
September 2017 | ||
* L4T 28.1 (JetPack 3.1) | ||
* TensorFlow 1.3 | ||
|
||
April 2017 | ||
* Initial Release | ||
* L4T 27.1 (JetPack 3.0) | ||
* TensorFlow 1.0 | ||
|
||
|
||
|
||
## License | ||
MIT License | ||
|
||
#### Build Issues | ||
Copyright (c) 2017 Jetsonhacks | ||
|
||
For various reasons, the build may fail. The 'debug' folder contains a version of the buildTensorFlow.sh script which is more verbose in the way that it describes both what it is doing and errors it encounters. See the debug directory for more details. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
#### Notes | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
#NVIDIA Jetson TX1 | ||
# Create a swap file and set up permissions | ||
# If a parameter is passed, it should be the place to create the swapfile | ||
SWAPDIRECTORY=$PWD | ||
SWAPSIZE=8 | ||
AUTOMOUNT="N" | ||
function usage | ||
{ | ||
echo "usage: createSwapFile [[[-d directory ] [-s size] -a] | [-h]]" | ||
echo "-d | --dir <directoryname> Directory to place swapfile" | ||
echo "-s | --size <gigabytes>" | ||
echo "-a | --auto Enable swap on boot in /etc/fstab " | ||
echo "-h | --help This message" | ||
} | ||
|
||
while [ "$1" != "" ]; do | ||
case $1 in | ||
-d | --dir ) shift | ||
SWAPDIRECTORY=$1 | ||
;; | ||
-s | --size ) shift | ||
SWAPSIZE=$1 | ||
;; | ||
-a | --auto ) AUTOMOUNT="Y" | ||
;; | ||
-h | --help ) usage | ||
exit | ||
;; | ||
* ) usage | ||
exit 1 | ||
esac | ||
shift | ||
done | ||
|
||
echo "Creating Swapfile at: " $SWAPDIRECTORY | ||
echo "Swapfile Size: " $SWAPSIZE"G" | ||
echo "Automount: " $AUTOMOUNT | ||
|
||
#Create a swapfile for Ubuntu at the current directory location | ||
fallocate -l $SWAPSIZE"G" $SWAPDIRECTORY"/swapfile" | ||
cd $SWAPDIRECTORY | ||
#List out the file | ||
ls -lh swapfile | ||
# Change permissions so that only root can use it | ||
sudo chmod 600 swapfile | ||
#List out the file | ||
ls -lh swapfile | ||
#Set up the Linux swap area | ||
sudo mkswap swapfile | ||
#Now start using the swapfile | ||
sudo swapon swapfile | ||
#Show that it's now being used | ||
swapon -s | ||
|
||
if [ "$AUTOMOUNT" = "Y" ]; then | ||
echo "Modifying /etc/fstab to enable on boot" | ||
SWAPLOCATION=$SWAPDIRECTORY"/swapfile" | ||
echo $SWAPLOCATION | ||
sudo sh -c 'echo "'$SWAPLOCATION' none swap sw 0 0" >> /etc/fstab' | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# NVIDIA Jetson TX2 | ||
# Install TensorFlow dependencies and prerequisites | ||
# Install Java and other dependencies by apt-get | ||
./scripts/installDependenciesPy3.sh | ||
./scripts/installBazel.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
# NVIDIA Jetson TX1 | ||
# NVIDIA Jetson TX2 | ||
cd $HOME/tensorflow | ||
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg | ||
mv /tmp/tensorflow_pkg/tensorflow-1.0.1-cp27-cp27mu-linux_aarch64.whl $HOME/ | ||
mv /tmp/tensorflow_pkg/tensorflow-*.whl $HOME/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#!/bin/bash | ||
# NVIDIA Jetson TX1 | ||
# NVIDIA Jetson TX2 | ||
# TensorFlow Installation | ||
# Install Bazel | ||
# Version 0.5.2 - v0.5.3 apparently has issues | ||
# We use the release distribution so that we don't have to build protobuf | ||
# | ||
INSTALL_DIR=$PWD | ||
cd $HOME | ||
wget --no-check-certificate https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel-0.4.5-dist.zip | ||
unzip bazel-0.4.5-dist.zip -d bazel-0.4.5-dist | ||
sudo chmod -R ug+rwx $HOME/bazel-0.4.5-dist | ||
wget --no-check-certificate https://github.com/bazelbuild/bazel/releases/download/0.5.2/bazel-0.5.2-dist.zip | ||
unzip bazel-0.5.2-dist.zip -d bazel-0.5.2-dist | ||
sudo chmod -R ug+rwx $HOME/bazel-0.5.2-dist | ||
# git clone https://github.com/bazelbuild/bazel.git | ||
cd bazel-0.4.5-dist | ||
patch -p0 < $INSTALL_DIR/patches/bazel.patch | ||
cd bazel-0.5.2-dist | ||
./compile.sh | ||
sudo cp output/bazel /usr/local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
#!/bin/bash | ||
# NVIDIA Jetson TX1 | ||
# NVIDIA Jetson TX2 | ||
# Install TensorFlow dependencies | ||
# Install Java | ||
sudo add-apt-repository ppa:webupd8team/java | ||
sudo apt-get update | ||
sudo apt-get install oracle-java8-installer -y | ||
# Install other dependencies | ||
sudo apt-get install zip unzip autoconf automake libtool curl zlib1g-dev maven -y | ||
# Install Python 2.x | ||
sudo apt-get install python-numpy swig python-dev python-pip python-wheel -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
# NVIDIA Jetson TX2 | ||
# Install TensorFlow dependencies | ||
# Install Java | ||
sudo add-apt-repository ppa:webupd8team/java | ||
sudo apt-get update | ||
sudo apt-get install oracle-java8-installer -y | ||
# Install other dependencies | ||
sudo apt-get install zip unzip autoconf automake libtool curl zlib1g-dev maven -y | ||
# Install Python 3.x | ||
sudo apt-get install python3-numpy swig python3-dev python3-pip python3-wheel -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.