ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

most of the Android phones do not have the OpenCL Driver

Open qixi666666 opened this issue 9 years ago • 21 comments

I find that most of the Android phones do not have the OpenCL Driver, so the ARM Compute library for Mali GPU can not be tested. For example , Mate 9, xiaomi note2, Samsung S7 , but all the Android phones can use the NEON, because it only use the CPU. Even after root the huawei mate 9 ,Mali GPU still can not be tested . Could you tell me which Android phone Certainly can use the Mali GPU for opencl.

qixi666666 avatar Jun 14 '17 03:06 qixi666666

Samsung Galaxy s8 (Exynos) has the OpenCL drivers, and all demos (Neon, OpenCL) could be run on it.

mo-morikawa avatar Jun 14 '17 04:06 mo-morikawa

thank you ,but I can only buy Samsung Galaxy s8 (snapdragon 835) in China , is it can be used by the Opencl ? And the Samsung Galaxy s8 is so expensive, is there another Android phones can be used for demos (OpenCL)?

qixi666666 avatar Jun 14 '17 07:06 qixi666666

I also used Lenovo K910. That had a non-ARM GPU, but it worked after a small tweak to the code, as posted in my latest issue. HTC_M9pw had the same issue and it worked. Both these are 32 bit devices.

mo-morikawa avatar Jun 14 '17 07:06 mo-morikawa

It does work on a stock unrooted mate9 You just need to create a symlink to libGLES_mali

AnthonyBarbier avatar Jun 14 '17 07:06 AnthonyBarbier

thank you , Samsung Galaxy s8 (snapdragon 835) can be used?

qixi666666 avatar Jun 14 '17 07:06 qixi666666

but the mate 9 do not have libGLES_mali.so

qixi666666 avatar Jun 14 '17 08:06 qixi666666

Snapdragon uses an Adreno GPU not Mali so while it might work performance is not likely to be great.

We've got some Mate 9 in the office and they definitely have libGLES_mali on them (It's required by Android to run the UI, etc.)

AnthonyBarbier avatar Jun 14 '17 08:06 AnthonyBarbier

image I can not find the /system/lib64/ and the libGLES_mali.so in my mate9, maybe the mate9 in China is different from your country..

qixi666666 avatar Jun 14 '17 09:06 qixi666666

Use adb shell to access your device, not the file browser on your computer

As far as I know there is only one version of the Mate 9: Kirin 960. If that's the case then it has a Mali GPU therefore will have a libGLES_mali

AnthonyBarbier avatar Jun 14 '17 09:06 AnthonyBarbier

2017-06-14 180356 use adb shell , I go to the /syetem/lib64/ , but I still can not find the libGLES_mali.so, and only have libGLESv1_CM.so libGLESv2.so libGLESv3.so Would you tell where I can find libGLES_mali.so? thank you very much.

qixi666666 avatar Jun 14 '17 10:06 qixi666666

You should be able to find it in /vendor/lib64/egl/

mpflanzer avatar Jun 14 '17 10:06 mpflanzer

Just checked, on the mate 9 it's /system/vendor/lib64/egl/libGLES_mali.so

AnthonyBarbier avatar Jun 14 '17 10:06 AnthonyBarbier

@AnthonyARM ,It is OK now! thank you ,it is my fault. The executable of "cl_convolution" and "neno_convolution" are successful in my mate 9 without "ln -s /system/lib64/egl/libGLES_mali.so /data/local/tmp/libOpenCL.so ". But when I put the code in a apk , the code of "cl_convolution" is wrong when it run at "CLScheduler::get().default_init();" The log from Android studio is "A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 30984". 1 This is the jniLibs of my apk , libcaffe_jin link java to libcl_convolution which have link to "libarm_compute-static.a". Would you tell me the reason? Every shep is OK untill it runs to the step "CLScheduler::get().default_init();" Should I link the libOpenCl.so to the libGLES_mali.so when I cross compile the OpenCL example? But I do not think so ,because the executable of "cl_convolution" is OK without "ln -s /system/lib64/egl/libGLES_mali.so /data/local/tmp/libOpenCL.so ". Meanwhile, I do not think it is the reason to the #104, because the first problem is phone , but the mate9 should be no problem. And my apk is OK when run the "neno_convolution".

qixi666666 avatar Jun 15 '17 08:06 qixi666666

You can use this app to detect the opencl library: https://play.google.com/store/apps/details?id=com.maxtrium.opencldevicetest

llhe avatar Jun 19 '17 01:06 llhe

the OpenCl-X is "No OpenCl detected", but my mate9 run the demo the executable of "cl_convolution" is OK. I feel puzzled at his reslut. I never face this problem, the code can run the executable on the device, but can not run apk on the same device.

qixi666666 avatar Jun 19 '17 03:06 qixi666666

It's because you created the symlink libOpenCL.so in /data/local/tmp, the apk can probably only check the standard paths like /system/lib/. However, in order to be able to create your symlink in /system/lib you would have to be root.

AnthonyBarbier avatar Jun 19 '17 08:06 AnthonyBarbier

Just thought of something else: you could try to replace libOpenCL.so by libGLES_mali.so in dlopen in OpenCL.cpp

If it doesn't work you might have to hardcode the entire path to libGLES_mali.so

AnthonyBarbier avatar Jun 27 '17 07:06 AnthonyBarbier

I have the same issue to run OpenCL code on Huawei Mate9. The problem is that we are not allowed to open libOpenCL.so or libGLES_mali.so from system folder on Android 7 or later. It may not be problem for development. But it causes trouble to deploy my OpenCL based app.

waynehong666 avatar Oct 09 '17 18:10 waynehong666

I believe this is only true if you are targeting API level 23 or above. This is not ideal, but this is a possible workaround. (PS: this is an Android limitation, this is not a Compute Library issue, as far as we know there isn't any way around it)

AnthonyBarbier avatar Oct 09 '17 18:10 AnthonyBarbier

Yes, this is not a Compute Library issue and not an Android limitation. Huawei could allow us to open OpenCL library by putting it into some ignore list (Don't remember the exact filename).

waynehong666 avatar Oct 09 '17 18:10 waynehong666