-
-
Notifications
You must be signed in to change notification settings - Fork 206
Open
Labels
Description
Target
I want to build CLBlast for android app with JNI.
Question
I am cross-compiling clblast for android with the following scripts.
- Q1. CLBlast requires OpenCL library, but I don't know If I need to cross-compile opencl library too? Or just build OpenCL on my macbook pro as usual.
- Q2. I'm coding android app with android studio, but I don't know should I use static opencl library
libOpenCL.a
orlibOpenCL.so
for CLBlast?
#!/bin/bash
ANDROID_NDK_PATH=/Users/david/Library/Android/sdk/ndk/25.1.8937393/
cmake .. \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=33 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_PATH \
-DCMAKE_ANDRFOID_STL_TYPE=gnustl_static \
-DBUILD_SHARED_LIBS=OFF \
-DOPENCL_ROOT=/Users/david/Documents/C++/OpenCL-SDK/build_android/OpenCL/include/ \
-DOPENCL_INCLUDE_DIRS=/Users/david/Documents/C++/OpenCL-SDK/build_android/OpenCL/include/ \
-DOPENCL_LIBRARIES=/Users/david/Documents/C++/OpenCL-SDK/build_android/OpenCL/libOpenCL.so
cmake --build . --config Release
cmake --install . --prefix install_android
Update 2023/10/25
- I cross-compile OpenCL into both static and shared libraries.
- To cross-compile CLBlast, I try both static and shared libraries for
-DOPENCL_LIBRARIES
, but only shared libraries work. - To enable CLBlast in android app, I import both
libOpenCL.a
andlibclblast.a
in android project.- Note here I use
libOpenCL.a
rather thanlibOpenCL.so
- Note here I use
- However, in this android project, the function
clGetPlatformsIDs
in JNI code returns -1001!
Any suggestions?