[Abstruct]
-Creating tensorflow development environment in order to develop Deep Learning anytime, anywhere.
-Build tensorflow on Arch Linux (TermuxArch) on Android.
-Run mnist_cnn on keras with tensorflow backend as benchmarking.
[Conclusion]
-Benchmarking score is better than I expected.
The score is close to a little old note PC. and better than mxnet and CNTK in my environment.
-It takes very very long time to build the tensorflow. So, please be careful to configure before building.
[Summary]
-Install Termux.
-Install TermuxArch (Arch Linux).
-Build and Install bazel.
-Build and Install tensorflow.
-Run Keras(tensorflow backend) benchmark.
[Details]
-Install Termux and TermuxArch by referring to first half of the follow URL.
http://oregaji.blogspot.jp/2018/04/how-to-create-keras-development.html
-Install oracle jdk8 and bazel 0.12 by referring to the follow "Build bazel on Arch Linux on Android".
http://oregaji.blogspot.com/2018/04/build-bazel-on-archlinux-arm-on-android.html
-Prepare to install tensorflow by referring "Installing TensorFlow from Sources".
https://www.tensorflow.org/install/install_sources
-git checkout latest r1.8 branch.
> git checkout r1.8
- **IMPORTANT** Modify third_party/png.BUILD. Add line
copts = ["-DPNG_ARM_NEON_OPT=0"],
Refer to the follow issue.
https://github.com/tensorflow/tensorflow/issues/18643#issuecomment-385234577
(Without this modification, Building tensorflow will fail at last.)
- Run configure.
> ./configure
Answer jemalloc=n, mpi=n.
-Build tensorflow.
> bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package --jobs 4
(It takes about 2 days. Plase be patient. Set Termux Notification Menu to "acquire wake lock".)
-Build python pip package.
> bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
-Do pip install.
> pip install /tmp/tensorflow_pkg/tensorflow-1.8.0-cp36-cp36m-linux_aarch64.whl
(tensorflow needs grpcio package. It takes about half day to build grpcio. Please be patient.)
If it succeeds, it's done!
-Run mnist_cnn on Keras with tensorflow backend.
-Install keras.
> pip install keras
-Change keras backend totensorflow.
Change ~/.keras/keras.json:
"backend": "tensorflow",
-Run mnist_cnn example on keras.
> git clone https://github.com/keras-team/keras.git
> cd keras/example
> python mnist_cnn.py
-Benchmark results:
mnist_cnn.py of keras example
tensorflow backend: 4min/epoch
mxnet backend: 33min/epoch
CNTK backend: 24min/epoch
tensorflow backend is very fast!
Is any acceleration working on aarch64!?
If you know something about this, Please tell me.
This learning speed is slower than desktop PC with GPU.
But it is faster than I expected.
This mobile deep learning development environment is very useful for me!