Tensorflow 1.2.0 GPU on TX2

Hello everyone,

Has anyone successfully build Tensorflow 1.2.0 with GPU for Jetson TX2 yet?

So far I’ve been able to build TF 1.0.1 GPU by following Jetsonhacks’ guide, as well as finding a TF 1.2.0 CPU python 3 wheel file that another user posted on this forum, but still no luck in building TF 1.2.0 GPU for TX2.

Any help or advices would be appreciated!

There’s a pull request on the JetsonHacks account that builds TF 1.2.0:


You should be able to merge it with earlier version. I have not tested it, but it seems pretty straightforward.

Lets try it!
Current state is

print(tf.version)
1.0.1

Upgrade started

it seems that 1.2.1 version is published at the github

  1. cd $home
  2. delete tensorflow
  3. git clone https://github.com/tensorflow/tensorflow.git
  4. cd tensorflow
  5. git checkout v1.2.1
    Note: checking out ‘v1.2.1’.

You are in ‘detached HEAD’ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD is now at b4957ff… Merge pull request #11156 from av8ramit/1.2.1
6) Now perhaps somehow the patch should be aplpied

it seems that after cloning a modified[patched] patch should be applied and it seems that new patch file should consist of 20 lines:

+diff --git a/a/tensorflow/workspace.bzl b/b/tensorflow/workspace.bzl
+index 2a206b0..d785473 100644
+--- a/a/tensorflow/workspace.bzl
++++ b/b/tensorflow/workspace.bzl
+@@ -150,11 +150,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
+   native.new_http_archive(
+       name = "eigen_archive",
+       urls = [
+-          "http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz",
+-          "https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz",
++          "http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/d781c1de9834.tar.gz",
++          "https://bitbucket.org/eigen/eigen/get/d781c1de9834.tar.gz",
+       ],
+-      sha256 = "ca7beac153d4059c02c8fc59816c82d54ea47fe58365e8aded4082ded0b820c4",
+-      strip_prefix = "eigen-eigen-f3a22f35b044",
++      sha256 = "a34b208da6ec18fa8da963369e166e4a368612c14d956dd2f9d7072904675d9b",
++      strip_prefix = "eigen-eigen-d781c1de9834",
+       build_file = str(Label("//third_party:eigen.BUILD")),
+   )
+

However it returns: patch: **** Only garbage was found in the patch input.
Omitting the patch procedure

it seems that the following lines should be in the file of the patch , rather than posted above:

diff --git a/a/tensorflow/workspace.bzl b/b/tensorflow/workspace.bzl
index 2a206b0..d785473 100644
--- a/a/tensorflow/workspace.bzl
+++ b/b/tensorflow/workspace.bzl
@@ -150,11 +150,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
   native.new_http_archive(
       name = "eigen_archive",
       urls = [
-          "http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz",
-          "https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz",
+          "http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/d781c1de9834.tar.gz",
+          "https://bitbucket.org/eigen/eigen/get/d781c1de9834.tar.gz",
       ],
-      sha256 = "ca7beac153d4059c02c8fc59816c82d54ea47fe58365e8aded4082ded0b820c4",
-      strip_prefix = "eigen-eigen-f3a22f35b044",
+      sha256 = "a34b208da6ec18fa8da963369e166e4a368612c14d956dd2f9d7072904675d9b",
+      strip_prefix = "eigen-eigen-d781c1de9834",
       build_file = str(Label("//third_party:eigen.BUILD")),
   )

now it returns :

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/a/tensorflow/workspace.bzl b/b/tensorflow/workspace.bzl
|index 2a206b0..d785473 100644
|--- a/a/tensorflow/workspace.bzl
|+++ b/b/tensorflow/workspace.bzl
--------------------------
File to patch:

trying with bazel 0.5.2 with instruction from https://syed-ahmed.gitbooks.io/nvidia-jetson-tx2-recipes/content/first-question.html https://devtalk.nvidia.com/default/topic/1000717/jetson-tx2/tensorflow-on-jetson-tx2/

bazel upgraded with https://github-production-release-asset-2e65be.s3.amazonaws.com/20773773/2a1587f8-5b51-11e7-9fc0-0d5c5bfd202b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170702%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170702T122312Z&X-Amz-Expires=300&X-Amz-Signature=8412090fac388e7652ef9b49bf4e70a3901732e8308d45382abf1c031ce37a39&X-Amz-SignedHeaders=host&actor_id=16374873&response-content-disposition=attachment%3B%20filename%3Dbazel-0.5.2-dist.zip&response-content-type=application%2Foctet-stream
:

bazel version
Extracting Bazel installation...
......................................
Build label: 0.5.2- (@non-git)
Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Sun Jul 2 13:05:23 2017 (1499000723)
Build timestamp: 1499000723
Build timestamp as int: 1499000723

repeating the steps:

git clone https://github.com/tensorflow/tensorflow.git
git checkout v1.2.1

executing

patch -p1 < $INSTALL_DIR/patches/tensorflow.patch
patching file /home/nvidia/tensorflow/tensorflow/workspace.bzl

executing

setTensorFlowEV.sh

executing

buildTensorFlow.sh

seems built fine

result = (tensorflow::io::PyRecordReader *)tensorflow::io::PyRecordReader::New((string const &)*arg1,arg2,(string const &)*arg3,arg4);
                                                                                                                                          ^
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-self-assign'
Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
  bazel-bin/tensorflow/tools/pip_package/build_pip_package
INFO: Elapsed time: 5232.278s, Critical Path: 616.27s
nvidia@tegra-ubuntu:~/Desktop/study/tensorrt/installTe

executing

./packageTensorFlow.sh 
Sun Jul 2 14:58:44 UTC 2017 : === Using tmpdir: /tmp/tmp.jYzk5wFTBE
~/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles ~/tensorflow
~/tensorflow
/tmp/tmp.jYzk5wFTBE ~/tensorflow
Sun Jul 2 14:58:47 UTC 2017 : === Building wheel
warning: no files found matching '*.dll' under directory '*'
warning: no files found matching '*.lib' under directory '*'
^Cinterrupted
mv: cannot stat '/tmp/tensorflow_pkg/tensorflow-1.2.1-cp27-cp27mu-linux_aarch64.whl': No such file or directory
nvidia@tegra-ubuntu:~/Desktop/study

trying with sudo

sudo ./packageTensorFlow.sh 
[sudo] password for nvidia: 
Sun Jul 2 14:59:41 UTC 2017 : === Using tmpdir: /tmp/tmp.KFty7jIjoS
~/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles ~/tensorflow
~/tensorflow
/tmp/tmp.KFty7jIjoS ~/tensorflow
Sun Jul 2 14:59:44 UTC 2017 : === Building wheel
warning: no files found matching '*.dll' under directory '*'
warning: no files found matching '*.lib' under directory '*'
~/tensorflow
Sun Jul 2 15:00:11 UTC 2017 : === Output wheel file is in: /tmp/tensorflow_pkg

upgrading pip:

You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip

installing

sudo pip install $HOME/wheel file