GithubHelp home page GithubHelp logo

Comments (6)

LakshmiKalaKadali avatar LakshmiKalaKadali commented on May 1, 2024

Hi @eltimen,

Enabling GPU support requires additional libraries and dependencies related to OpenCL. This might be the reason for
the error tflite::gpu::gl and tflite::gpu::OptionalAndroidHardwareBuffer. Please try to add the following to the Android manifest in order to detect GPU delegate.

<uses-library android:name="libOpenCL.so"
           android:required="false"/>

<uses-library android:name="libOpenCL-pixel.so"
           android:required="false"/>

Also Verify that the NDK version (r25b) is compatible with the TensorFlow Lite version you are trying to build.

Thank You

from tensorflow.

eltimen avatar eltimen commented on May 1, 2024

Hi @LakshmiKalaKadali,

I'm not using Gradle or Android Studio. I just tried to build libtensorflow-lite.so for Android using CMake following the documentation and I got the linker errors above.

I tried to build it with Bazel as mentioned here and build was successful. According to this page NDK r25b should be compatible with this TFLite version.

According to the documentation, TensorFlow Lite supports both ways to build it for Android: with CMake and with Bazel. Looks like CMake building is broken with enabled GPU delegate in this version.

from tensorflow.

pkgoogle avatar pkgoogle commented on May 1, 2024

This looks like a duplicate of #65744, investigating.

from tensorflow.

pkgoogle avatar pkgoogle commented on May 1, 2024

Hi @eltimen, I was able to build fine with these steps:

git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
cd tensorflow_src
git switch r2.16
cd ..
mkdir tflite_build
cd tflite_build
cmake -S ../tensorflow_src/tensorflow/lite -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_SYSTEM_PROCESSOR=aarch64 -D BUILD_SHARED_LIBS=ON -D TFLITE_ENABLE_GPU=ON -D CMAKE_SYSTEM_NAME=Linux -D CMAKE_SYSTEM_VERSION=29 -D ANDROID_PLATFORM=29 -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a -D ANDROID_ABI=arm64-v8a -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake

Please note $ANDROID_NDK is the path to my NDK, which is 25b.

I am building on MacOS, you didn't specify an OS so that could be an issue.

Can you please let us know what OS you are using? Additionally please review my reproduce steps and let me know if I did something different than what you are doing? Thanks.

from tensorflow.

eltimen avatar eltimen commented on May 1, 2024

Hi @pkgoogle, I use Ubuntu 22.04.
I'm building TFLite from the tag v2.16.1, but you are building it from the branch r2.16.
Can you try to reproduce this using the release 2.16.1 version?

from tensorflow.

pkgoogle avatar pkgoogle commented on May 1, 2024

Hi @eltimen, I am using a Debian system, and went to that tag, but am using NDK=r25c, I am still not reproducing the error:

git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
cd tensorflow_src
git checkout v2.16.1
cd ..
mkdir tflite_build
cd tflite_build
cmake -S ../tensorflow_src/tensorflow/lite -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_SYSTEM_PROCESSOR=aarch64 -D BUILD_SHARED_LIBS=ON -D TFLITE_ENABLE_GPU=ON -D CMAKE_SYSTEM_NAME=Linux -D CMAKE_SYSTEM_VERSION=29 -D ANDROID_PLATFORM=29 -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a -D ANDROID_ABI=arm64-v8a -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake

It looks like my Clang is different (14.0.7) probably from the different r25c.

Can you try with a fresh repo, perhaps fresh NDK, and ensure you follow the same steps exactly? Let me know if somehow that resolves your issue.

from tensorflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.