GithubHelp home page GithubHelp logo

Comments (10)

sh1r0 avatar sh1r0 commented on May 27, 2024

https://groups.google.com/forum/#!msg/android-ndk/NbUq9FDDZOo/TJJsAS6nM7wJ

from caffe-android-lib.

jainanshul avatar jainanshul commented on May 27, 2024

Thanks @sh1r0 as per the link above JNI functions should be compiled with softfp but armeabi-v7a-hard-softfp still sets the ABI to armeabi-v7a-hard and CXXFLAGS to -mhard-float. The only difference being the flag -D_NDK_MATH_NO_SOFTFP=1, which I am not sure how it helps in this case?

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on May 27, 2024

Please refer to tests/device/hard-float/jni/Android.mk in Android NDK.

from caffe-android-lib.

jainanshul avatar jainanshul commented on May 27, 2024

I did and I understand the meaning of D_NDK_MATH_NO_SOFTFP=1 but I am not sure why is that needed to compile JNI code. Why can't armeabi-v7a-hard be used to compile JNI code? It seems like someone was able to compile the JNI code with armeabi-v7a-hard with NEON at #27 (comment). So my original question still remains, why armeabi-v7a-hard-softfp and not armeabi-v7a-hard?

So tests/device/hard-float/jni/Android.mk says that using -D_NDK_MATH_NO_SOFTFP=1 links the library with libm_hard.a instead of libm.a. How is that helping with the JNI code?

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on May 27, 2024

Sorry, per my previous tests, the current setup is the only way I can successfully make it. I guessed the key point is that JNI somehow needs softfp instead of hardfp. But if you succeed in making everything work by simply using armeabi-v7a-hard, please kindly let me know (PR is also welcome). Thanks.

from caffe-android-lib.

jainanshul avatar jainanshul commented on May 27, 2024

But again armeabi-v7a-hard-softfp that are using is still using hardfp with the exception on using libm for soft abi math functions. If JNI needs softfp then we should compile JNI code with softfp and not with armeabi-v7a-hard-softfp or armeabi-v7a-hard.

Thanks anyways. My setup is a little different where I don't have any JNI code but was trying to use openblas with softfp on ARM7 as rest of my system is softfp but OpenBLAS crashes on me. I have other libraries that are dependent on OpenCV for example so I can't compile opencv with hardfloat without breaking these other modules which would be required if I am compiling Caffe and OpenBLAS with hardfloat. I don't want to compile two copies of opencv one with softfp for other softfp module and hardffp for caffe and OpenBLAS.

Do you know of a way to call from softfp based library using floating point to call into Caffe compiled with hardfp? The link you mentioned says that adding
__attribute__((pcs("aapcs"))) is to tell to the compiler how a function expect to receive its arguments so it won't help unless I change the Caffe code to add this attribute to all the functions taking or returnign floats.

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on May 27, 2024

If you hope to have everything with softfp, you can build openblas with ARMv5 as a workaround.

from caffe-android-lib.

jainanshul avatar jainanshul commented on May 27, 2024

Do you know if ARMv5 OpenBLAS is compatible with ARMv7 based chipsets?

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on May 27, 2024

Yes, please refer to https://github.com/sh1r0/caffe-android-lib/blob/dev/scripts/build_openblas.sh.

from caffe-android-lib.

jainanshul avatar jainanshul commented on May 27, 2024

Thank you, will give that a try. Appreciate all your help. Your project was immensely helpful to me.

from caffe-android-lib.

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.