Skip to content

Commit 52fd02e

Browse files
committed
Clean GUIDE, README, remove C++ benchmark
1 parent 54ef07c commit 52fd02e

File tree

3 files changed

+96
-450
lines changed

3 files changed

+96
-450
lines changed

GUIDE.md

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Here's the basic plan: build a 32-bit version of [Protobuf](https://github.com/g
2222

2323
1. [Install basic dependencies](#1-install-basic-dependencies)
2424
2. [Build Protobuf](#2-build-protobuf)
25-
3. [Build Bazel](#3-build-bazel)
26-
4. [Install USB Memory as Swap](#4-install-a-memory-drive-as-swap-for-compiling)
25+
3. [Install USB Memory as Swap](#3-install-a-memory-drive-as-swap-for-compiling)
26+
4. [Build Bazel](#4-build-bazel)
2727
5. [Compiling TensorFlow](#5-compiling-tensorflow)
2828
6. [Cleaning Up](#6-cleaning-up)
2929
7. [References](#references)
@@ -93,7 +93,7 @@ Now move into the new `protobuf` directory, configure it, and `make` it. _Note:
9393

9494
```shell
9595
cd protobuf
96-
git checkout v3.0.0
96+
git checkout v3.1.0
9797
./autogen.sh
9898
./configure
9999
make -j 4
@@ -107,13 +107,74 @@ Great! You should now have `protoc` installed in `/usr/local/bin`, and should be
107107
protoc --version
108108
```
109109

110-
Now that we have the `protoc` compiler, we can start building Bazel. Let's move up a directory and do that.
110+
Now that we have the `protoc` compiler, let's install a USB stick as additional swap memory.
111111

112112
```
113113
cd ..
114114
```
115115

116-
### 3. Build Bazel
116+
### 3. Install a Memory Drive as Swap for Compiling
117+
118+
In order to succesfully build TensorFlow, your Raspberry Pi needs a little bit more memory to fall back on. Fortunately, this process is pretty straightforward. Grab a USB storage drive that has at least 1GB of memory. I used a flash drive I could live without that carried no important data. That said, we're only going to be using the drive as swap while we compile, so this process shouldn't do too much damage to a relatively new USB drive.
119+
120+
First, put insert your USB drive, and find the `/dev/XXX` path for the device.
121+
122+
```shell
123+
sudo blkid
124+
```
125+
126+
As an example, my drive's path was `/dev/sda1`
127+
128+
Once you've found your device, unmount it by using the `umount` command.
129+
130+
```shell
131+
sudo umount /dev/XXX
132+
```
133+
134+
Then format your device to be swap:
135+
136+
```shell
137+
sudo mkswap /dev/XXX
138+
```
139+
140+
If the previous command outputted an alphanumeric UUID, copy that now. Otherwise, find the UUID by running `blkid` again. Copy the UUID associated with `/dev/XXX`
141+
142+
```shell
143+
sudo blkid
144+
```
145+
146+
Now edit your `/etc/fstab` file to register your swap file. (I'm a Vim guy, but Nano is installed by default)
147+
148+
```shell
149+
sudo nano /etc/fstab
150+
```
151+
152+
On a separate line, enter the following information. Replace the X's with the UUID (without quotes)
153+
154+
```bash
155+
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none swap sw,pri=5 0 0
156+
```
157+
158+
Save `/etc/fstab`, exit your text editor, and run the following command:
159+
160+
```shell
161+
sudo swapon -a
162+
```
163+
164+
If you get an error claiming it can't find your UUID, go back and edit `/etc/fstab`. Replace the `UUID=XXX..` bit with the original `/dev/XXX` information.
165+
166+
```shell
167+
sudo nano /etc/fstab
168+
```
169+
170+
```bash
171+
# Replace the UUID with /dev/XXX
172+
/dev/XXX none swap sw,pri=5 0 0
173+
```
174+
175+
Alright! You've got swap! Don't throw out the `/dev/XXX` information yet- you'll need it to remove the device safely later on.
176+
177+
### 4. Build Bazel
117178

118179
To build [Bazel](https://github.com/bazelbuild/bazel), we're going to need to download a zip file containing a distribution archive. Let's do that now and extract it into a new directory called `bazel`:
119180

@@ -156,7 +217,7 @@ Finally, we have to add one thing to `tools/cpp/cc_configure.bzl` - open it up f
156217
nano tools/cpp/cc_configure.bzl
157218
```
158219

159-
Place the line `return "arm"` around line 141 (at the beginning of the `_get_cpu_value` function):
220+
Place the line `return "arm"` around line 133 (at the beginning of the `_get_cpu_value` function):
160221

161222
```shell
162223
...
@@ -180,7 +241,7 @@ sudo cp output/bazel /usr/local/bin/bazel
180241
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!
181242

182243
```shell
183-
$ bazel
244+
bazel
184245

185246
Usage: bazel <command> <options> ...
186247

@@ -217,67 +278,6 @@ Move out of the `bazel` directory, and we'll move onto the next step.
217278
cd ..
218279
```
219280

220-
### 4. Install a Memory Drive as Swap for Compiling
221-
222-
In order to succesfully build TensorFlow, your Raspberry Pi needs a little bit more memory to fall back on. Fortunately, this process is pretty straightforward. Grab a USB storage drive that has at least 1GB of memory. I used a flash drive I could live without that carried no important data. That said, we're only going to be using the drive as swap while we compile, so this process shouldn't do too much damage to a relatively new USB drive.
223-
224-
First, put insert your USB drive, and find the `/dev/XXX` path for the device.
225-
226-
```shell
227-
sudo blkid
228-
```
229-
230-
As an example, my drive's path was `/dev/sda1`
231-
232-
Once you've found your device, unmount it by using the `umount` command.
233-
234-
```shell
235-
sudo umount /dev/XXX
236-
```
237-
238-
Then format your device to be swap:
239-
240-
```shell
241-
sudo mkswap /dev/XXX
242-
```
243-
244-
If the previous command outputted an alphanumeric UUID, copy that now. Otherwise, find the UUID by running `blkid` again. Copy the UUID associated with `/dev/XXX`
245-
246-
```shell
247-
sudo blkid
248-
```
249-
250-
Now edit your `/etc/fstab` file to register your swap file. (I'm a Vim guy, but Nano is installed by default)
251-
252-
```shell
253-
sudo nano /etc/fstab
254-
```
255-
256-
On a separate line, enter the following information. Replace the X's with the UUID (without quotes)
257-
258-
```bash
259-
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none swap sw,pri=5 0 0
260-
```
261-
262-
Save `/etc/fstab`, exit your text editor, and run the following command:
263-
264-
```shell
265-
sudo swapon -a
266-
```
267-
268-
If you get an error claiming it can't find your UUID, go back and edit `/etc/fstab`. Replace the `UUID=XXX..` bit with the original `/dev/XXX` information.
269-
270-
```shell
271-
sudo nano /etc/fstab
272-
```
273-
274-
```bash
275-
# Replace the UUID with /dev/XXX
276-
/dev/XXX none swap sw,pri=5 0 0
277-
```
278-
279-
Alright! You've got swap! Don't throw out the `/dev/XXX` information yet- you'll need it to remove the device safely later on.
280-
281281
### 5. Compiling TensorFlow
282282

283283
First things first, clone the TensorFlow repository and move into the newly created directory.
@@ -298,7 +298,7 @@ grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g'
298298
Next, we need to delete a particular line in `tensorflow/core/platform/platform.h`. Open up the file in your favorite text editor:
299299

300300
```shell
301-
$ sudo nano tensorflow/core/platform/platform.h
301+
sudo nano tensorflow/core/platform/platform.h
302302
```
303303

304304
Now, scroll down toward the bottom and delete the following line containing `#define IS_MOBILE_PLATFORM` (around line 48):
@@ -315,7 +315,7 @@ This keeps our Raspberry Pi device (which has an ARM CPU) from being recognized
315315
Now let's configure the build:
316316
317317
```shell
318-
$ ./configure
318+
./configure
319319
320320
Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python
321321
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
@@ -324,9 +324,9 @@ Do you wish to build TensorFlow with Hadoop File System support? [y/N] N
324324
Please input the desired Python library path to use. Default is [/usr/local/lib/python2.7/dist-packages]
325325
Do you wish to build TensorFlow with OpenCL support? [y/N] N
326326
Do you wish to build TensorFlow with GPU support? [y/N]
327-
N```
327+
```
328328

329-
_Note: if you want to build for Python 3, specify `/usr/bin/python3` for Python's location._
329+
_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._
330330
331331
Now we can use it to build TensorFlow! **Warning: This takes a really, really long time. Several hours.**
332332

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Donate
44

5-
If you find the binaries and instructions in this repository useful, [please consider donating to help keep this repository maintained](https://pledgie.com/campaigns/33260). It takes hours of work for each new version of TensorFlow, as well as responding to issues and pull requests.
5+
If you find the binaries and instructions in this repository useful, [please consider donating to help keep this repository maintained](https://pledgie.com/campaigns/33260). It takes hours of work to compile each new version of TensorFlow, in addition to time spent responding to issues and pull requests.
66

77
## Intro
88

@@ -25,25 +25,37 @@ This is the easiest way to get TensorFlow onto your Raspberry Pi 3. Note that cu
2525
First, install the dependencies for TensorFlow:
2626

2727
```shell
28-
$ sudo apt-get update
28+
sudo apt-get update
2929

3030
# For Python 2.7
31-
$ sudo apt-get install python-pip python-dev
31+
sudo apt-get install python-pip python-dev
3232

3333
# For Python 3.3+
34-
$ sudo apt-get install python3-pip python3-dev
34+
sudo apt-get install python3-pip python3-dev
3535
```
3636

3737
Next, download the wheel file from this repository and install it:
3838

3939
```shell
4040
# For Python 2.7
41-
$ wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.12.1/tensorflow-0.12.1-cp27-none-linux_armv7l.whl
42-
$ sudo pip install tensorflow-0.12.1-cp27-none-linux_armv7l.whl
41+
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.12.1/tensorflow-0.12.1-cp27-none-linux_armv7l.whl
42+
sudo pip install tensorflow-0.12.1-cp27-none-linux_armv7l.whl
4343

4444
# For Python 3.3+
45-
$ wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.12.1/tensorflow-0.12.1-py3-none-any.whl
46-
$ sudo pip3 install tensorflow-0.12.1-py3-none-any.whl
45+
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.12.1/tensorflow-0.12.1-cp34-cp34m-linux_armv7l.whl
46+
sudo pip3 install tensorflow-0.12.1-cp34-cp34m-linux_armv7l.whl
47+
```
48+
49+
Finally, we need to reinstall the `mock` library to keep it from throwing an error when we import TensorFlow:
50+
51+
```shell
52+
# For Python 2.7
53+
sudo pip uninstall mock
54+
sudo pip install mock
55+
56+
# For Python 3.3+
57+
sudo pip3 uninstall mock
58+
sudo pip3 install mock
4759
```
4860

4961
And that should be it!
@@ -56,18 +68,18 @@ Instructions on setting up a Docker image to run on Raspberry Pi are being maint
5668

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

59-
#### "tensorflow-0.11-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."
71+
#### "tensorflow-0.12.1-cp27-none-linux_armv7l.whl is not a supported wheel on this platform."
6072

6173
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:
6274

6375
```
64-
$ sudo pip2 install tensorflow-0.12.1-cp27-none-linux_armv7l.whl
76+
sudo pip2 install tensorflow-0.12.1-cp27-none-linux_armv7l.whl
6577
```
6678

67-
Vice-versa for trying to install the Python 3 wheel. If you get the error "tensorflow-0.11-py3-none-any.whl is not a supported wheel on this platform.", try this command:
79+
Vice-versa for trying to install the Python 3 wheel. If you get the error "tensorflow-0.12.1-py3-none-any.whl is not a supported wheel on this platform.", try this command:
6880

6981
```
70-
$ sudo pip3 install tensorflow-0.12.1-py3-none-any.whl
82+
sudo pip3 install tensorflow-0.12.1-cp34-cp34m-linux_armv7l.whl
7183
```
7284

7385
## Building from Source

0 commit comments

Comments
 (0)