This Repository provides a reference application that uses JOCL to provide access to PoCL-R in Java.
In order to build the reference app, a number of programs are needed. Here is a list:
- Head over to the PortableCL docs and install the required packages.
- To build JOCL, the use of Maven is also required. On Ubuntu, this can be installed with
sudo apt install maven
. - Android Studio, the version used for development can be found in the "Relevant Versions" subsection. Make sure to use android studio in order to get the android development files also described in the "Relevant Versions" subsection. See "Installing Android packages" for details on how to do this.
Clone the repo with its submodules with the following command:
git clone --recurse-submodules [email protected]:cpc/PoCL-R-Reference-Android-Java-Client.git
or initialize submodules after cloning with:
git submodule update --init --recursive
Go to <source-dir>/external/JOCLRoot/
and run ./build_jocl.sh
. This will build JOCL for android with the same android parameters described in the "Relevant Versions" subsection. If you decide to use a different version, you also need to change that in the script.
[note] This script only builds for
arm64-v8a
Finally, open Android studio and build the app
Android constantly updates packages and libraries that can break with newer versions. Below is a list of relevent versions currently used:
What | Version | where to check |
---|---|---|
Android Studio | Flamingo (2022.2.1) | file > settings > appearance & behavior > system settings > updates |
JDK | 17 | file > project structure > SDK Location > gradle settings > gradle JDK |
Minimum SDK version | 24 | android/app/build.gradle > minSdk |
Targeted SDK version | 33 | android/app/build.gradle > targetSdk |
Gradle | 8.0 | file > project structure > project > gradle version |
Android Gradle plugin version | 8.0.2 | file > project structure > project > android gradle plugin version |
CMake | 3.22.1 | android/app/src/main/cpp/CMakeLists.txt > cmake_minimum_required |
NDK | 25.1.8937393 | (android layout in project tab) app/cpp/inlcudes/NDK |
C++ | 17 | android/app/build.gradle > cppFlags '-std=c++<version>' |
In order to use the remote device, a remote device needs to be available. See the PoCL Documentation on how to set up and build the remote server
Some phones provide a OpenCL library that can be used in C. This library needs to be whitelisted by the vendor. This can be checked like so:
- adb into the phone
- run:
and check that
cat /vendor/etc/public.libraries.txt
libOpenCL.so
is there
- install Android Studio
- install the android sdk from
Tools > SDK Manager > SDK Platforms
- install the android Native Development Kit (NDK) from
Tools > SDK Manager > SDK Tools
- install CMake from
Tools > SDK Manager > SDK Tools
- Some OpenCL implementations on Android do not provide all the metadata needed by pocl. A work around is to also have a kernel be built both for the proxy and pocl-r devices.
- Turning the screen off and on will cause the return buffer in the mendelbrot demo to be filled with zeros.
This project is made and maintained by the CPC group.
MIT License