Git Product home page Git Product logo

cl_stub's Introduction

CL_Stub

Android Linux macOS
CircleCI Run Status Build Status

For easy use of OpenCL drivers by building a shared stub library, which is especially useful for Android due to lack of Google's official support. For phones not having OpenCL drivers, you may find the other project useful.

Usage

See Project Integration

Android

  1. Build
  • configure NDK environment: export ANDROID_NDK=/path/to/your/ndk/, e.g. export ANDROID_NDK=/opt/android-ndk-r16b
  • arm: mkdir build_arm; cd build_arm; cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_PLATFORM=android-17 ..; make
  • arm64: mkdir build_arm64; cd build_arm64; cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-17 ..; make
  1. Run push the library and executable to the phone by adb: adb push test_stub /data/local/tmp and then run adb shell /data/local/tmp/test_stub, below are two sample outputs:
open OpenCL library at /system/lib/egl/libGLES_mali.so
Using platform: ARM Platform
Found device: Mali-T880 5MHz
Using device: Mali-T880
result: {19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 }

open OpenCL library at /system/lib64/libOpenCL.so
Using platform: QUALCOMM Snapdragon(TM)
Found device: QUALCOMM Adreno(TM) OpenCL 2.0 Adreno(TM) 540 1MHz
Using device: QUALCOMM Adreno(TM)
result: {19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 }

macOS

Just build mkdir build && cd build && cmake .. && make and run ./test_stub sample output:

open OpenCL library at /System/Library/Frameworks/OpenCL.framework/OpenCL
Using platform: Apple
Found device: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz OpenCL 1.2  2600MHz
Found device: HD Graphics 4000 OpenCL 1.2  1250MHz
Using device: HD Graphics 4000
result: {19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 }

Linux

Note: you may need to install OpenCL driver on Linux, try: sudo apt update && sudo apt install ocl-icd-opencl-dev

Just build mkdir build && cd build && cmake .. && make and run ./test_stub sample output:

open OpenCL library at /usr/lib/x86_64-linux-gnu/libOpenCL.so
Using platform: NVIDIA CUDA
Found device: GeForce GTX 1070 OpenCL 1.2 CUDA 1771MHz
Found device: GeForce GTX 1070 OpenCL 1.2 CUDA 1683MHz
Using device: GeForce GTX 1070
result: {19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 }

Project Integration

  • library use, just copy libcl_stub.so and correspoding header files (include/)
  • cmake integration: see example project here.

Credit

Examples in test_stub.cc are borrowed from OpenCL-examples

cl_stub's People

Contributors

csarron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cl_stub's Issues

OpenCL not found ๐Ÿ˜ญ ๐Ÿ™ please help

Device Android
Os ANDROID 10
Qualcomm Snapdragon 660 processor
Gpu Adreno TM 514
In my device already available OpenCL 2.0
But when running some OpenCL related applications showing no OpenCL platform found
Selected OpenCL platform not found
LibOpenCl.so not found in termux and another application

  1. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/vendor/lib64/
  2. after showing same
    Please help me
    Screenshot_20201216-122238
    Screenshot_20201216-122238
    Screenshot_20201216-000414
    Screenshot_20201214-184632
    Screenshot_20201214-183715

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.