Comments (4)
The main reason is build time.
There are only 2GB memory on Firefly.
Build on PC with large memory is much faster than build on Firefly.
Native build is possible, but not recommended.
BR
from tensorflow-hrt.
I am interested in the native build and please upload it
Thanks,
from tensorflow-hrt.
The following procedure was tested 6 month ago. It is not required to patch Eigen now.
Tensorflow uses bazel building system to create the binaries, which will download the necessary packages from internet automatically. However, when building tensorflow on firelfy (RK3399) board, there are several issues to be resolved.
-
Use the newest Bazel for ARM architecture detection
-
Insert an external USB stick as memory swap partition
-
Patch Eigen to fix compilation of Jacobi rotations with ARM NEON (Not required now)
-
Set resource limits on bazel to build
Here is the detailed steps to build tensorflow from source on firefly
- Install Bazel from source
Please visit https://docs.bazel.build/versions/master/install-compile-source.html for official guide.
Install openjdk:
sudo apt-get install openjdk-8-jdk
Download bazel release: https://github.com/bazelbuild/bazel/releases/download/0.5.2/bazel-0.5.2-dist.zip
Unzip the archive and call bash ./compile.sh. Copy the generated output/bazel to /usr/bin
2. Add the memory swap partition
Insert one USB stick (>=2G) on the USB port and suppose it is /dev/sdx
Format it as swap partition:
mkswap /dev/sdx
This command should output the UID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. If that is not the case, please use blkid to get the UID.
Add the swap entry in /etc/fstab: add one line in /etc/fstab
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none swap sw,pri=5 0 0
Enable swap by:
swapon -a
3. Configure tensorflow
./configure Just select the default options.
4. Patch Eigen (Not required now)
The patch is included here and is from: https://bitbucket.org/eigen/eigen/commits/d781c1de9834/
Download all external packages needed first: bazel fetch //tensorflow/examples/label_image
Change directory to where Eigen is unpacked: cd ~/.cache/bazel/bazel_xxx/xxxxxxx/external/eigenarchive
patch -p1 < eigen.patch
5. Use below command to build tensorflow
bazel build -c opt --local_resources 1024,1.0,1.0 --verbose_failures //tensorflow/examples/label_image
6. Try label_image
If every thing goes well, after about one hour, label_image should be created at bazel-bin/tensorflow/examples/label_image.
Download the model data and the sample photo by:
curl -L "https://storage.googleapis.com/downoad.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz" | tar -C tensorflow/examples/label_image/data -xz
Now, please run:
bazel-bin/tensorflow/examples/label_image/label_image
from tensorflow-hrt.
How do you set ComputeLibrary in TensorflowOnACL configuration?
I don't see this in your native compilation instruction
Thanks,
from tensorflow-hrt.
Related Issues (8)
- bazel build issue about missing dependency HOT 1
- How can I build TensorFlowOnACL without OPENCL? HOT 1
- How Can I build TensorFlowOnACL for Android
- tensorflow build failed. as something about bazel.
- how to use tensorflow lite?
- Error during import tensorflow: cannot find module libarm_compute.so
- How can I install tensorboard?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow-hrt.