How to enable OpenCL on Nexus 5

Google added OpenCL drivers in Android 4.2, but then removed them from Android 4.3. As a result, with Android 4.4 we're unable to run OpenCL applications on Nexus 5, even if the GPU (Qualcomm's Adreno 330) supports OpenCL 1.2.

However, Qualcomm still leaves a backdoor to enable OpenCL in their latest Android driver (shipped with Kitkat KOT49H), which is located at /system/vendor/lib/libllvm-a3xx.so as an user-mode driver. It means we can still enable OpenCL functions by installing the missing libraries back to the device.

Here is the steps (ROOT only):

  1. Clone this repository to your local machine
    https://github.com/madeye/opencl-android-proprietary
  2. Attach your device, and install the missing libraries following these instructions https://github.com/madeye/opencl-android-proprietary/tree/master/adreno-3xx
$ adb push jellybean/system/lib /sdcard/
$ adb shell
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# cp /sdcard/libOpenCL.so /system/lib/
# cp /sdcard/libllvm-a3xx.so /system/lib/
# chmod 644 /system/lib/libOpenCL.so
# chmod 644 /system/lib/libllvm-a3xx.so

Author

Max Lv

A programmer focusing on High-performance Computing.

comments powered by Disqus