most of the Android phones do not have the OpenCL Driver
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.
Samsung Galaxy s8 (Exynos) has the OpenCL drivers, and all demos (Neon, OpenCL) could be run on it.
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)?
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.
It does work on a stock unrooted mate9 You just need to create a symlink to libGLES_mali
thank you , Samsung Galaxy s8 (snapdragon 835) can be used?
but the mate 9 do not have libGLES_mali.so
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.)
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..
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
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.
You should be able to find it in /vendor/lib64/egl/
Just checked, on the mate 9 it's /system/vendor/lib64/egl/libGLES_mali.so
@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".
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".
You can use this app to detect the opencl library: https://play.google.com/store/apps/details?id=com.maxtrium.opencldevicetest
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.
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.
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
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.
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)
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).