Skip to content

Commit 9f37d7e

Browse files
authored
Merge pull request #115 from grassgit/grassgit-strech-update
Update GUIDE.md for latest Raspbian & TF
2 parents c962a5e + 6248b74 commit 9f37d7e

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

GUIDE.md

+39-19
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ _[Back to readme](README.md)_
1515
## Overview
1616

1717
These instructions were crafted for a [Raspberry Pi 3 Model B](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) running a vanilla copy of Raspbian 8.0 (jessie). It appears to work on Raspberry Pi 2, but [there are some kinks that are being worked out](https://github.com/tensorflow/tensorflow/issues/445#issuecomment-196021885). If these instructions work for different distributions, let me know!
18+
Updated (2017-09-11) to work with the latest (HEAD) version of tensorflow on Raspbian Strech (Vanilla version september 2017) and Python 3.5.
1819

1920
Here's the basic plan: build a RPi-friendly version of [Bazel](https://github.com/bazelbuild/bazel) and use it to build TensorFlow.
2021

@@ -253,39 +254,58 @@ Once in the directory, we have to write a nifty one-liner that is incredibly imp
253254
```shell
254255
grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g'
255256
```
257+
Updating tensorflow/core/platform/platform.h and WORKSPACE as listed in the previous version is no longer needed with the latest version of tensorflow.
258+
* the IS_MOBILE_PLATFORM check now includes a specific check for the Raspberry
259+
* numeric/1.2.6 is no longer listed WORKSPACE
256260

257-
Next, we need to delete a particular line in `tensorflow/core/platform/platform.h`. Open up the file in your favorite text editor:
261+
Finally, we have to replace the eigen version dependency. The version included in the current tensorflow version may result in an error (near the end of the build):
258262

259263
```shell
260-
sudo nano tensorflow/core/platform/platform.h
264+
ERROR: /mnt/tensorflow/tensorflow/core/kernels/BUILD:2128:1: C++ compilation of rule '//tensorflow/core/kernels:svd_op' failed: gcc failed: error executing command
265+
...com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
266+
...
267+
external/eigen_archive/Eigen/src/Jacobi/Jacobi.h:359:55: error: 'struct Eigen::internal::conj_helper<__vector(4) __builtin_neon_sf, Eigen::internal::Packet2cf, false, false>' has no member named 'pmul'
261268
```
262269

263-
Now, scroll down toward the bottom and delete the following line containing `#define IS_MOBILE_PLATFORM` (around line 48):
270+
to resolve this
264271

265-
```cpp
266-
#elif defined(__arm__)
267-
#define PLATFORM_POSIX
268-
...
269-
#define IS_MOBILE_PLATFORM <----- DELETE THIS LINE
272+
```shell
273+
sudo nano tensorflow/workspace.bzl
270274
```
271275

272-
This keeps our Raspberry Pi device (which has an ARM CPU) from being recognized as a mobile device.
273-
274-
Finally, we have to adjust the protocol to access the Numeric JS library- for some reason the Cloudflare security certificates don't work properly over `https`. We'll need to fix this in the Bazel `WORKSPACE` file:
276+
Replace the following
275277

276-
```shell
277-
sudo nano WORKSPACE
278+
```
279+
native.new_http_archive(
280+
name = "eigen_archive",
281+
urls = [
282+
"http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz",
283+
"https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz",
284+
],
285+
sha256 = "ca7beac153d4059c02c8fc59816c82d54ea47fe58365e8aded4082ded0b820c4",
286+
strip_prefix = "eigen-eigen-f3a22f35b044",
287+
build_file = str(Label("//third_party:eigen.BUILD")),
288+
)
278289
```
279290

280-
Around line 283, change `https` to `http`:
291+
with
281292

282293
```
283-
http_file(
284-
name = "numericjs_numeric_min_js",
285-
url = "http://cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js",
286-
)
294+
native.new_http_archive(
295+
name = "eigen_archive",
296+
urls = [
297+
"http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/d781c1de9834.tar.gz",
298+
"https://bitbucket.org/eigen/eigen/get/d781c1de9834.tar.gz",
299+
],
300+
sha256 = "a34b208da6ec18fa8da963369e166e4a368612c14d956dd2f9d7072904675d9b",
301+
strip_prefix = "eigen-eigen-d781c1de9834",
302+
build_file = str(Label("//third_party:eigen.BUILD")),
303+
)
287304
```
288305

306+
Reference: https://stackoverflow.com/questions/44418657/how-to-build-eigen-with-arm-neon-compile-error-for-tensorflow
307+
308+
**These options have changed with exception of jemalloc use No for all**
289309
Now let's configure the build:
290310

291311
```shell
@@ -302,7 +322,7 @@ Do you wish to build TensorFlow with OpenCL support? [y/N] N
302322
Do you wish to build TensorFlow with CUDA support? [y/N] N
303323
```
304324

305-
_Note: if you want to build for Python 3, specify `/usr/bin/python3` for Python's location and `/usr/local/lib/python3.4/dist-packages` for the Python library path._
325+
_Note: if you want to build for Python 3, specify `/usr/bin/python3` for Python's location and `/usr/local/lib/python3.5/dist-packages` for the Python library path._
306326

307327
Bazel will now attempt to clean. This takes a really long time (and often ends up erroring out anyway), so you can send some keyboard interrupts (CTRL-C) to skip this and save some time.
308328

0 commit comments

Comments
 (0)