ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

CL is always crashed on android

Open Kang3498 opened this issue 8 years ago • 6 comments

Output of 'strings libarm_compute.so | grep arm_compute_version':

Platform: arm64-v8a

Operating System: Android 8.0

Problem description:

I'm trying to apply ACL to my android application using JNI. I can use NEON and GLES version, but CL is not working here. Whenever I call "CLScheduler::get().default_init()" in my JNI function, app is crashed leaving message "Fatal signal 6 (SIGABRT)", there's no other message. How can I use it in my android?

Kang3498 avatar Jul 24 '18 08:07 Kang3498

Did you build with either asserts=1 or debug=1 ? Do you see anything in logcat or dmesg ?

If this is in a Java app then I suspect it is because OpenCL is not whitelisted on your device.

AnthonyBarbier avatar Jul 24 '18 08:07 AnthonyBarbier

@AnthonyARM

Hello, I'm using the pre-built binary v18.05 for Android, android-arm64-v8a-cl-debug, but there's no other message. I'm using Samsung galaxy 9+ and if I run OpenCL-Z, it's telling me this device supports OpenCL 2.0. Is there any case that the vendor prevent 3rd-party app from using OpenCL?

Kang3498 avatar Jul 24 '18 09:07 Kang3498

It's an Android P and above restriction on all non-SDK interfaces: https://developer.android.com/preview/restrictions-non-sdk-interfaces Basically you can use OpenCL from native binaries, but not in APKs unless the manufacturer explicitly whitelist it (Which isn't the case for the S9)

AnthonyBarbier avatar Jul 24 '18 09:07 AnthonyBarbier

@AnthonyARM But isn't that a restriction on Android P or above? I found that Android 8 is acturally Android O. However, I can't get this working either on a Samsung s9, so I wonder if there another layer of restriction upon those? I search up a bit, and found that the only official post related is this, https://android-developers.googleblog.com/2016/06/improving-stability-with-private-cc.html. Which I believe can be resolved if we manually include our own copy of the library in the app.

Thanks for the help.

bowiegou avatar Jul 24 '18 13:07 bowiegou

Apparently, I solved my problem, by NOT putting the OpenCL library into the build. The app invokes the system library flawlessly. However, I believe this will not work on Android N or above which will be coming out pretty soon.

bowiegou avatar Aug 04 '18 15:08 bowiegou

Closing for now as it seems you have solved the issue. Feel free to reopen it.

mdigiorgio avatar Aug 31 '18 09:08 mdigiorgio