Skip to content

Commit 82c022d

Browse files
committed
RPi3 TensorFlow 0.8 Release Candidate 0
1 parent 0d44df6 commit 82c022d

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

GUIDE.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Now move into the new `protobuf` directory, configure it, and `make` it. _Note:
7878

7979
```shell
8080
cd protobuf
81+
git checkout d5fb408d
8182
./autogen.sh
8283
./configure --prefix=/usr
8384
make -j 4
@@ -102,11 +103,11 @@ cd ../..
102103
git clone https://github.com/bazelbuild/bazel.git
103104
```
104105

105-
Next, go into the new `bazel` direcotry and immediately checkout version 0.1.4 of Bazel. _Note: we do this because a hack-y workaround we do later on doesn't work for the most recent version of Bazel. If you have instructions for building Bazel 2.0 or later on Raspberry Pi, please send a pull request!_
106+
Next, go into the new `bazel` direcotry and immediately checkout version 0.2.1 of Bazel.
106107

107108
```shell
108109
cd bazel
109-
git checkout tags/0.1.4
110+
git checkout 0.2.1
110111
```
111112

112113
After that, copy the two Protobuf files mentioned earlier into the Bazel project. Note the naming of the files in this step- it must be precise.
@@ -116,6 +117,28 @@ sudo cp /usr/bin/protoc third_party/protobuf/protoc-linux-arm32.exe
116117
sudo cp ../protobuf/java/core/target/protobuf-java-3.0.0-beta-2.jar third_party/protobuf/protobuf-java-3.0.0-beta-1.jar
117118
```
118119

120+
Before building Bazel, we need to set the `javac` maximum heap size for this job, or else we'll get an OutOfMemoryError. To do this, we need to make a small addition to `bazel/scripts/bootstrap/compile.sh`. (Shout-out to @SangManLINUX for [pointing this out.](https://github.com/samjabrahams/tensorflow-on-raspberry-pi/issues/5#issuecomment-210965695).
121+
122+
```shell
123+
nano scripts/bootstrap/compile.sh
124+
```
125+
126+
Move down to line 128, where you'll see the following block of code:
127+
128+
```shell
129+
run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \
130+
-d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \
131+
-encoding UTF-8 "@${paramfile}"
132+
```
133+
134+
At the end of this block, add in the `-J-Xmx500M` flag, which sets the maximum size of the Java heap to 500 MB:
135+
136+
```
137+
run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \
138+
-d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \
139+
-encoding UTF-8 "@${paramfile}" -J-Xmx500M
140+
```
141+
119142
Now we can build Bazel! _Note: this also takes some time._
120143

121144
```shell
@@ -129,7 +152,7 @@ sudo mkdir /usr/local/bin
129152
sudo cp output/bazel /usr/local/bin/bazel
130153
```
131154

132-
To make sure it's working properly, run `bazel` on the command line and verify it prints help text.
155+
To make sure it's working properly, run `bazel` on the command line and verify it prints help text. Note: this may take 15-30 seconds to run, so be patient!
133156

134157
```shell
135158
$ bazel
@@ -239,6 +262,8 @@ git clone --recurse-submodules https://github.com/tensorflow/tensorflow
239262
cd tensorflow
240263
```
241264

265+
_Note: if you're looking to build to a specific version or commit of TensorFlow (as opposed to the HEAD at master), you should `git checkout` it now`
266+
242267
Once in the directory, we have to write a nifty one-liner that is incredibly important. The next line goes through all files and changes references of 64-bit program implementations (which we don't have access to) to 32-bit implementations. Neat!
243268

244269
```shell
@@ -273,25 +298,7 @@ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
273298
And then install it!
274299

275300
```shell
276-
sudo pip install /tmp/tensorflow_pkg/tensorflow-0.7.1-cp27-none-linux_armv7l.whl
277-
```
278-
279-
### 5.5 Building the Distributed Runtime
280-
281-
If all has gone according to plan, you should be the proud owner of a TensorFlow-capable Raspberry Pi! But before removing your swap drive, you may want to consider building one of the optional TensorFlow components, such as the [initial distributed runtime](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/core/distributed_runtime). Building it is a breeze (relatively):
282-
283-
```shell
284-
bazel build -c opt --local_resources 1024,1.0,1.0 --verbose_failures --copt="-mfpu=neon" tensorflow/core/distributed_runtime/rpc:grpc_tensorflow_server
285-
```
286-
287-
And then test it out by running a local GRPC server:
288-
289-
```
290-
$ bazel-bin/tensorflow/core/distributed_runtime/rpc/grpc_tensorflow_server --cluster_spec='local|localhost:2222' --job_name=local --task_id=0
291-
292-
I tensorflow/core/distributed_runtime/rpc/grpc_tensorflow_server.cc:74] Peer local 1 {localhost:2222}
293-
I tensorflow/core/distributed_runtime/rpc/grpc_channel.cc:199] Initialize HostPortsGrpcChannelCache for job local -> {localhost:2222}
294-
I tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc:203] Started server with target: grpc://localhost:2222
301+
sudo pip install /tmp/tensorflow_pkg/tensorflow-0.8.0rc0-cp27-none-linux_armv7l.whl
295302
```
296303

297304
### 6. Cleaning Up

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ sudo apt-get install python-pip python-dev
2626
Next, download the wheel file from this repository and install it:
2727

2828
```shell
29-
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/raw/master/bin/tensorflow-0.7.1-cp27-none-linux_armv7l.whl
29+
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/raw/master/bin/tensorflow-0.8.0rc0-cp27-none-linux_armv7l.whl
3030

31-
sudo pip install tensorflow-0.7.1-cp27-none-linux_armv7l.whl
31+
sudo pip install tensorflow-0.8.0rc0-cp27-none-linux_armv7l.whl
3232
```
3333

3434
And that should be it!
@@ -37,12 +37,12 @@ And that should be it!
3737

3838
_This section will attempt to maintain a list of remedies for problems that may occur while installing from `pip`_
3939

40-
#### "tensorflow-0.7.1-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."
40+
#### "tensorflow-0.8.0rc0-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."
4141

4242
This wheel was built with Python 2.7, and can't be installed with a version of `pip` that uses Python 3. If you get the above message, try running the following command instead:
4343

4444
```
45-
sudo pip2 install tensorflow-0.7.1-cp27-none-linux_armv7l.whl
45+
sudo pip2 install tensorflow-0.8.0rc0-cp27-none-linux_armv7l.whll
4646
```
4747

4848
## Building from Source
File renamed without changes.
20.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)