I tried to build Tensorflow on the DragonBoard 410c. To make sure I had ‘lots’ of space I formatted a 64GB SDCard and mounted it in the directory /home/linaro/workspace. I think 64GB should be enough storage space to load the source and compile it. I also made sure I had ‘lots’ of memory, I installed zram, and I also allocated 1.5GB of swapspace on the eMMC. After setup free tells me I have over 4GB of available swap space. Although it won’t be fast I think this should be enough space and memory to build tensorflow.
The first thing you need is the build tool bazel so I needed to build bazel first. The following script should build bazel:
# build bazel from source because there is no arm64 version prebuilt
sudo apt-get install -y build-essential openjdk-8-jdk python3 zip
cp output/bazel ~/bin
Unfortunately this fails on the DragonBoard 410c. Java runs out of heap space. I tried several different methods to increase the java heap space, but it always fails to build bazel. So I built bazel on a larger arm64 machine (with 3GB of RAM, the script works fine) and copied the 91MB bazel executable to the 410c.
Next you need to build tensor flow. The following script should build tensorflow:
# build tensorflow
sudo apt-get install python-numpy python-dev python-pip python-wheel python-all-dev
#sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel
git clone https://github.com/tensorflow/tensorflow
git checkout master
echo answer to the first configure option is "/usr/bin/python2.7"
echo Accept all of the defaults for the remaining configuration questions
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
sudo pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-py2-none-any.whl
This takes a really long time to run, but eventually builds the whl file. I haven’t gone to the next step, actually doing something useful with tensorflow, or even running the examples. a task for another day.
On a side note: The faster machine that had successfully built bazel failed trying to build tensorflow. It appears that the newer compiler has issues (internal compiler error). Here is the tail of the build error message.
ERROR: /home/linaro/workspace/tensorflow/tensorflow/contrib/lite/toco/BUILD:169:1: C++ compilation of rule '//tensorflow/contrib/lite/toco:graph_transformations' failed (Exit 1)
In file included from /usr/include/c++/7/bits/move.h:54:0,
/usr/include/c++/7/type_traits: In instantiation of 'struct std::remove_const<std::default_delete<toco::Operator> >':
/usr/include/c++/7/type_traits:1574:67: required from 'struct std::remove_cv<std::default_delete<toco::Operator> >'
/usr/include/c++/7/type_traits:380:12: required from 'struct std::is_pointer<std::default_delete<toco::Operator> >'
/usr/include/c++/7/type_traits:154:31: required from 'struct std::__not_<std::is_pointer<std::default_delete<toco::Operator> > >'
/usr/include/c++/7/type_traits:143:12: required from 'struct std::__and_<std::__not_<std::is_pointer<std::default_delete<toco::Operator> > >, std::is_default_constructible<std::default_delete<toco::Operator> > >'
/usr/include/c++/7/bits/unique_ptr.h:135:47: required from 'class std::__uniq_ptr_impl<toco::Operator, std::default_delete<toco::Operator> >'
/usr/include/c++/7/bits/unique_ptr.h:163:33: required from 'class std::unique_ptr<toco::Operator>'
tensorflow/contrib/lite/toco/graph_transformations/read_fake_quant_min_max.cc:46:56: required from here
/usr/include/c++/7/type_traits:1553:12: internal compiler error: in layout_decl, at stor-layout.c:600
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 412.981s, Critical Path: 61.35s
FAILED: Build did NOT complete successfully
Full Disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.