在Android中运行openCL [英] running openCL in android

查看:99
本文介绍了在Android中运行openCL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于这方面有很多教程和文章,但是我没有确切了解如何处理libOpenCL.so文件.许多供应商未将其包含在手机中,但是我的应用程序今天需要支持最大数量的手机,因此我是否需要为它们中的每一个获取兼容的libOpenCL.so文件?

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?

推荐答案

Android Open Source Project尚未正式支持OpenCL

OpenCL is not officially supported by Android Open Source Project

请参阅: Google为什么选择RenderScript而不是OpenCL

但是,似乎设备制造商通过添加驱动程序来提供支持.

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

请参阅: Android是否支持OpenCL?

意识到OpenCL与图形驱动程序在硬件堆栈中处于相似的层,并且任何特定的实现方式都将取决于制造商,并且特定于该设备.您不能仅从一台ARM64设备中获取libOpenCL.so并期望由于特定于片上系统的自定义(内核,DSP,GPU等的数量)而期望用于另一设备

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.)

我的建议来自: C ++,OpenCV和什么" ;用于跨平台GPU编程

如果您需要最大的支持-请坚持使用C/C ++代码.

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

如果您需要OpenCL来使您的应用程序即使具有并行化的代码也能表现出色,那么您的选择是检查该库是否存在,并警告用户缺少支持.理想情况下,然后在没有OpenCL的情况下回退到那些设备上的并行化代码.

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.

直到Google将OpenCL纳入Android兼容性定义文档并需要一些元数据属性之前,只有通过在设备上检查应用程序,应用程序才能知道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.

这篇关于在Android中运行openCL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆