Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorFlow C binding for Raspberry Pi #30359

Closed
marianopeck opened this issue Jul 3, 2019 · 18 comments
Closed

TensorFlow C binding for Raspberry Pi #30359

marianopeck opened this issue Jul 3, 2019 · 18 comments
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype: raspberry pi Raspberry Pi Build/Installation Issues TF 1.13 Issues related to TF 1.13 type:build/install Build and install issues

Comments

@marianopeck
Copy link

System information

  • TensorFlow version (you are using): 1.13.1
  • Are you willing to contribute it (Yes/No): yes, at least as a tester

Describe the feature and the current behavior/state.
I asked on StackOverflow if there was a TensorFlow C binding for ARM/RaspberryPi but I got no answer after many days.

I couldn't find anything on the website, so I suspect this is not yet available?

If it is just a matter that you don't distribute the binaries, I have no troubles to compile it myself if I have the instructions and if it is known to work. But I haven't found anything confirming that either.

Will this change the current api? How?
No

Who will benefit with this feature?
All language bindings that use the C library and want to run on any ARM board

Any Other info.

@freedomtan
Copy link
Contributor

The last paragraph of the "TensorFlow for C" you cited points to a how-to file which does show you how to build TensorFlow C API from source code with bazel

@marianopeck
Copy link
Author

Thanks @freedomtan. I didn't know if something special compilation was needed for ARM. Are you aware of people/projects compiling it and using successfully?

@ravikyram ravikyram self-assigned this Jul 4, 2019
@ravikyram ravikyram added subtype: raspberry pi Raspberry Pi Build/Installation Issues type:build/install Build and install issues labels Jul 4, 2019
@ravikyram ravikyram assigned petewarden and unassigned ravikyram Jul 4, 2019
@ravikyram ravikyram added stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 1.13 Issues related to TF 1.13 labels Jul 4, 2019
@freedomtan
Copy link
Contributor

freedomtan commented Jul 5, 2019

@marianopeck something like

CC=clang-6.0 CXX=clang++-6.0 \
bazel build --config opt --local_resources 1024.0,0.5,0.5 \
--copt=-mfpu=neon-vfpv4 \
--copt=-ftree-vectorize \
--copt=-funsafe-math-optimizations \
--copt=-ftree-loop-vectorize \
--copt=-fomit-frame-pointer \
--copt=-DRASPBERRY_PI \
--host_copt=-mfpu=neon-vfpv4 \
--host_copt=-ftree-vectorize \
--host_copt=-funsafe-math-optimizations \
--host_copt=-ftree-loop-vectorize \
--host_copt=-fomit-frame-pointer \
--host_copt=-DRASPBERRY_PI \
//tensorflow/tools/lib_package:libtensorflow

works for me.

@ravikyram
Copy link
Contributor

@marianopeck Just to verify did you get a chance to follow instructions as suggested by freedomtan .Thanks!

@marianopeck
Copy link
Author

Hi @ravikyram
Not yet. I will see if I can try it this week.
BTW, if there is a compilation instruction and people claim it works, any reason why the binaries are not officially distributed as the rest of the "TensorFlow for C"?

@marianopeck
Copy link
Author

Hi @freedomtan
Which version did you use? It's 2.0? Or older too? I would like to try with 1.13.1 or similar.
Thanks

@freedomtan
Copy link
Contributor

@marianopeck I use master branch most of the time. I think it works on TensorFlow versions before 1.10 to current master.

@marianopeck
Copy link
Author

Hi @freedomtan
Thanks, I am trying now to compile it myself but I wasn't even able to compile bazel on the first place :( I am getting this issue: bazelbuild/bazel#8882
If I am able to pass that, I will continue..

@freedomtan
Copy link
Contributor

@marianopeck I haven't tried newer bazel, general comment is to increase your swap space and maximum Java heap size (e.g., -J-Xmx1024m instead of -J-Xmx512m)

@marianopeck
Copy link
Author

Hi, as I found no binary available, I had to manage myself.
I finally took the time to write down everything I found during my attempt to get TensorFlow C library compiled for Raspberry Pi. In that tutorial, I point back to this issue in case any progress is made.
Thank you

@freedomtan
Copy link
Contributor

good to see another effort on Smalltalk + TensorFlow. Smalltalk is one of my favorite language. I tried Pharo bindings for TensorFlow before and was able to use both TensorFlow C API and TensorFlow Lite C API on x86 machines

@marianopeck
Copy link
Author

Hi @freedomtan
We are in the same boat then :) That's great to hear. The Pharo bindings are actually a port made by @SergeStinckwich from the work done on Cuis Smalltalk. The latter was mostly done by @gerasdf and he is now doing most of the port to VASmalltalk.
I am interested in hearing about your experiments. To avoid making noise in this issue, I will send you an email.
Thanks!

@SergeStinckwich
Copy link

hi @marianopeck, @freedomtan already have done some contributions to the Pharo port.
Yes all on the same boat, let's try to go in the same direction :-) Let's discuss about that in ESUG 2019 ?

@marianopeck
Copy link
Author

OK, I sent you both and the rest of the involved parts a private email to so that we can continue discussing :)

@PINTO0309
Copy link
Contributor

PINTO0309 commented Jul 20, 2019

Although I do not have C language implementation skills, I tried to generate a binary for RaspberryPi of Tensorflow v1.14.0. I have not confirmed the operation.
https://github.com/PINTO0309/Tensorflow-bin.git
https://github.com/PINTO0309/Tensorflow-bin/tree/master/C-library/1.14.0-armv7l

@marianopeck
Copy link
Author

That worked perfectly!!

@tensorflowbutler
Copy link
Member

Hi There,

We are checking to see if you still need help on this, as you are using an older version of tensorflow which is officially considered end of life . We recommend that you upgrade to the latest 2.x version and let us know if the issue still persists in newer versions. Please open a new issue for any help you need against 2.x, and we will get you the right help.

This issue will be closed automatically 7 days from now. If you still need help with this issue, please provide us with more information.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype: raspberry pi Raspberry Pi Build/Installation Issues TF 1.13 Issues related to TF 1.13 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

7 participants