-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Problems with using arm version on Android #363
Comments
Hi @kurak38 , Sorry, we didn't provide 0.2.9.rc2 version for Android so far. Please try our old version. It's armv5tel ( single thread and without lapack ). Xianyi |
hmm, but there is no lapacke.h and I need it |
@kurak38, Why do you need BLAS and LAPACK on Android? |
1 similar comment
@kurak38, Why do you need BLAS and LAPACK on Android? |
I'm porting some other library that requires both |
LAPACKE is a C wrapper for LAPACK, which also calls LAPACK fortran code. Thus, I thinks it need a Fortran compiler for Android. |
Is it possible that you send me your source code? (kurak38@gmail.com) |
@kurak38 , I think the source code is on github.com. We didn't have other codes for ARM. |
Interesting. i'd definitely want to cross-compile for android. We use it for running neural nets on Android. |
I have managed to compile it by taking advantage of https://github.com/simonlynen/android_libs to build only lapack. Then add it to openBlas for android mention before and it worked. |
@xianyi Are there instructions to compile the latest HEAD on android? or is it too complicated |
@xianyi I ask, because I want to compile for android with multithreads, rather than just a single-threaded version |
In OpenBLAS/GotoBLAS, it used some System V IPC functions in multi-threading implementation, which is not supported in Android NDK. @wernsaar , any suggestions? |
On 02.05.2014 11:53, Zhang Xianyi wrote:
Android does not support System V IPC in the kernel, but has a mechanism Best regards Werner |
Hi, any news about android support? I'm trying to build 0.2.8 for armv7 (I downloaded the sources from the 0.2.8 tag at: https://github.com/xianyi/OpenBLAS/tree/v0.2.8 ) Now I'm struggling to put together an android makefile, and I was wondering if the one used to build the armv5 version is available somewhere. Thanks! |
@wernsaar , could you answer this question? |
@xianyi We are interested in this at BVLC/caffe#2619. We are now relaying on eigen for this build but we want to recover openblas support. |
I'm also interested in this. What is the intended result of a11555c ? Should it build and link correctly on Android? |
@ibrahima , so far, it can generate multi-threaded BLAS library by NDK cross compiler. However, I didn't test it on any Android phone. I think it should work. |
Hmm, I was actually able to build libopenblas.so and run the tests from https://github.com/xianyi/OpenBLAS/wiki/User-Manual on my Nexus 5 but I had to fiddle a bit with different toolchains and flags. I think the current branch needs some more flags in Makefile.arm for Android to link properly. Also it's a bit tricky because I think some flags that I needed are due to Android 5.0/5.1 and may cause things to break on earlier versions. Here's what I currently have in my Makefile.arm:
but some of those flags might not be necessary because I ran into a lot of errors trying to get things working. I ended up using some ndk10 version of gcc 4.8 I think (not sure because I tried a lot of different toolchains and have different things floating around). I think a recent version of the NDK is needed for hardfloat support. All of the above is provided as reference for anyone else trying this out; if I can clean up my changes and document it correctly I will try and submit a pull request that makes this easier. My actual end goal is to run https://github.com/scalanlp/breeze on Android with native BLAS and I'm still struggling with getting openblas loaded via JNI but at least now I know that the shared library works from C code. |
@ibrahima See also my comment at BVLC/caffe#2619 (comment) |
@ibrahima , Thank you for your work. |
@xianyi I've tried with but there is some missing define in gemv.c
Update: i solved this with USE_THREAD=0 |
@ibrahima What do you think of #562 (comment)? |
@bhack , interesting. I didn't meet |
@bhack , @ibrahima , For #562 (comment) issue, the |
@xianyi I think that the problem was with NDK cross compiling Openblas Makefile generate a binary getarch as an ELF 32-bit LSB executable, ARM so that cannot be executed by make script on a x86 host. |
@xianyi I've builded the library under NDK. This is the readelf -A output. It is softfp on armv7a and VFPV3. Will this crash at runtime?
|
@bhack , which |
@xianyi Yes ARMV7. Do you want that I make a test to see if it crash?
|
Yes, you can test it. Thank you |
@xianyi What kind of test do you suggest to run? |
You can try to run |
Yes as i supposed go in segmentation fault on clblas_dgemm call. |
@bhack , I think I can add softfp ABI for OpenBLAS Android target. I need to learn how to generate the test binary and deploy on my android phone. |
It is quite easy to test. I've simply used the standalone toolchain to compile your example, uploaded the executable with adb push and run with adb shell after changing file permission. On the phone I think you need to have a rooted firmware but probably you can try with adb on the emulator. |
Thank you for your tip. I can run the test on my android phone without root now. Put the C binary into /data/local folder.
|
There is some activity on opencv side at opencv/opencv#5098 |
@bhack Thank you for the update. |
@xianyi @ibrahima I wonder how to cross compile OpenBLAS with NDK exactly. The first issue I can imagine is there's not Fortran compiler in NDK, are you using something else? Second, I ignore this anyway and follow the instructions in https://github.com/xianyi/OpenBLAS/wiki/User-Manual, i.e.
However, I get the output with error.
I can find the missing shm.h somewhere in the toolchain folder, but it's not under sys. Should I modify the source? I'm using NDK r10e. I also have tried to integrate the pre-compiled OpenBLAS from http://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-armv7a.tar.gz/download into my C++ code which calls some cblas functions, but had the following error when trying to load the OpenBLAS shared library. My project is built using tools from taka-no-me/android-cmake#59 with ANDROID_ABI="armeabi-v7a-hard with NEON"
Thank you very much. |
I don't have time to give a full explanation, but basically you need to build a standalone NDK toolchain (with headers from 5.0/5.1 IIRC) and modify the NDK source to build a gcc toolchain. I took the instructions from http://danilogiulianelli.blogspot.com/2013/02/how-to-build-gcc-fortran-cross-compiler.html and updated the patch for the latest version of the ndk. These repos might help with building an up to date NDK toolchain with Fortran: https://github.com/biotrump/ndk-r10e-build Hope that helps! |
@ibrahima Do you have the header problem I mentioned? Which API level do you use in the toolchain? Thank you. |
@wyansfu, could you try develop branch? I think it support android. https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android |
@wyansfu I used the latest API level, I think some of the needed headers weren't added until 5.0 or 5.1. |
@wyansfu I have managed to compile with multithreading and LAPACK, but that requires a Fortran compiler as @ibrahima mentionned. I'm putting instructions together, should not be long. Did you try building without multithreading and LAPACK though (USE_THREAD=0 NO_LAPACK=1)? I had it working with NDK r10e out of the box. You should specify the Android sysroot for the GCC toolchain. Try CC="/path/to/ndk/toolchain/arm-linux-androideabi-4.9/prebuilt/.../bin/arm-linux-androideabi-gcc --sysroot=/path/to/ndk/platforms/android-21/arch-arm" |
@xianyi It compiles and works with your instructions. Thank you very much. There seems to be a bug in the makefile. For path with '-', the make command may fail, e.g.
reports
And I have to use
@ibrahima @buffer51 I have not tried to compile the LAPACK since I'm not using it. But your posts are anyway very helpful, and I bet there are lots of people want to compile OpenBLAS with LAPACK. Thank you all the same. |
@wyansfu If it works fine without the USE_THREAD=0 don't add it, it was just to disable multi-threading to be sure it compiled. |
so,is there any andorid arm-based openbla binary package ? can I use openblas on android system? thx. |
@xianyi do you have the plan to compile the android version of 0.2.9.rc2,since we need the lapacke,but i'm not good at this,or could anyone give me some assist?thanks! |
@grandLee Please see https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android for instructions to build OpenBLAS for Android, with lapacke. |
@xianyi i try build with the version 0.2.19,. but my app is crash every time ! |
@shenyuhit Hi, do you mean that building OpenBLAS doesn't work (i.e. your |
@buffer51 yes, my app crashes with the libopenblas.a generated by myself! Do you have any advise ? |
Do you happen to have logs from the crashes? |
Hi,
I am using Download openblas-0.2.9-rc2-armv6.tar.gz (8.1 MB) (http://sourceforge.net/projects/openblas/files/v0.2.9-rc2-arm/) and I have problem with undefined references to:
shmget, shmat, shmdt, shctl, get_nprocs, pthread_atfork, stderr and _gfortran_compare_string.
I am using APP_STL := gnustl_static with LDLIBS : libgnustl_static.a and libsupc++.a. GNU STL from android-ndk-r9d version 4.8 of gcc.
The most problematic, I think, would be function with shared memory, while on Android there is no such thing to use.
Please give me any advice
Thanks in advance
Adam
The text was updated successfully, but these errors were encountered: