running openCL in android

筅森魡賤 提交于 2020-01-16 09:10:15

问题


Well there are many tutorials and post about this, but I am not getting exactly how to deal with libOpenCL.so file. Many vendors does not include it inside phone, but my app needs to support maximum available phones today, so do I need to get compatible libOpenCL.so file for each of them?


回答1:


OpenCL is not officially supported by Android Open Source Project

See: Why did Google choose RenderScript instead of OpenCL

However it appears that Device Manufacturers are including support by adding in the driver.

See: Does Android support OpenCL?

Realize that OpenCL is at a similar layer in the hardware stack as the graphics driver and any particular implementation will depend on the manufacturer and would be specific to that device. You can't just take a libOpenCL.so from one ARM64 device and expect to work for another due to system-on-a-chip specific customizations (number of cores, DSPs, GPUs etc.)

My recommendation from: C++, OpenCV and "what" for cross-platform GPU programing

If you want maximum support - stick to C/C++ code.

If you need OpenCL to make your app performant even with parallelized code, your option is to check if the library is there and warn the user about the lack of support. Ideally then fall back to the parallelized code on those devices without OpenCL.

Until Google makes OpenCL part of the Android Compatibility Definition Document and requires some metadata property, only by the app checking on the device can the app know that OpenCL is even available.




回答2:


Adding to the answer of @Morrison Chang:

  • You can not rely on all version of OpenCL in all devices to have everything supported. So I would do a dinamic library loading, and query at runtime for the OpenCL methods are available.

  • Regarding the library with OpenCL support, sometimes is not even called like that. For example libGLESmali.so has OpenCL symbols and can be used directly.



来源:https://stackoverflow.com/questions/44897271/running-opencl-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!