diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 40 | ||||
-rw-r--r-- | README.md | 2 |
3 files changed, 28 insertions, 15 deletions
@@ -7,6 +7,7 @@ Development (next version) * Two CUDA API sample programs are added: SGEMM and DAXPY * All correctness tests and performance clients work on CUDA like they did for OpenCL - Kernels are now cached based on their tuning parameters: fits the use-case of 'OverrideParameters' +- Cross-compiling for Android is now supported using CMake; instructions are added to the README - Improved performance for small GEMM problems by going from 3 to 1 optional temporary buffers - Various minor fixes and enhancements - Added tuned parameters for various devices (see README) diff --git a/CMakeLists.txt b/CMakeLists.txt index 610e5149..28093980 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,23 +165,35 @@ if(TUNERS) endif() endif() -# Locates the reference BLAS libraries in case the tests need to be compiled. The "FindclBLAS.cmake", -# "FindCBLAS.cmake" and "FindcuBLAS.cmake" are included. -if(CLIENTS OR TESTS) - find_package(CBLAS) - if(OPENCL) - find_package(clBLAS) +# Don't search for system libraries when cross-compiling +if(${CMAKE_SYSTEM_NAME} STREQUAL Android) + if(TESTS) + message(STATUS "Compilation of the tests disabled for the Android target") + set(TESTS OFF) endif() - if(CUBLAS) - find_package(cuBLAS) + if(CLIENTS) + message(STATUS "Head-to-head performance comparison not supported in the clients for the Android target") endif() - if(NOT CLBLAS_FOUND AND NOT CBLAS_FOUND) - if(TESTS) - message(STATUS "Could NOT find clBLAS nor a CPU BLAS, disabling the compilation of the tests") - set(TESTS OFF) +else() + + # Locates the reference BLAS libraries in case the tests need to be compiled. The "FindclBLAS.cmake", + # "FindCBLAS.cmake" and "FindcuBLAS.cmake" are included. + if(CLIENTS OR TESTS) + find_package(CBLAS) + if(OPENCL) + find_package(clBLAS) + endif() + if(CUBLAS) + find_package(cuBLAS) endif() - if(CLIENTS) - message(STATUS "Could NOT find clBLAS nor a CPU BLAS, head-to-head performance comparison not supported in the clients") + if(NOT CLBLAS_FOUND AND NOT CBLAS_FOUND) + if(TESTS) + message(STATUS "Could NOT find clBLAS nor a CPU BLAS, disabling the compilation of the tests") + set(TESTS OFF) + endif() + if(CLIENTS) + message(STATUS "Could NOT find clBLAS nor a CPU BLAS, head-to-head performance comparison not supported in the clients") + endif() endif() endif() endif() @@ -345,7 +345,7 @@ Alternatively, you can cross-compile the library and the test/client/tuner execu -DCMAKE_SYSTEM_VERSION=19 \ # Set the appropriate Android API level -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \ # Set the appropriate device architecture (e.g. armeabi-v7a or arm64-v8a) -DCMAKE_ANDROID_NDK=$ANDROID_NDK_PATH \ # Assumes $ANDROID_NDK_PATH points to your NDK installation - -DCMAKE_ANDROID_STL_TYPE=gnustl_shared \ + -DCMAKE_ANDROID_STL_TYPE=gnustl_static \ -DOPENCL_ROOT=/path/to/vendor/OpenCL/lib/folder/ # Should contain libOpenCL.so and CL/cl.h For any potential issues, first check [cmath 'has not been declared' errors](https://stackoverflow.com/questions/45183525/compilation-error-with-ndk-using-cstatic/46433625). Also, if you are encountering errors such as `#error Bionic header ctype.h does not define either _U nor _CTYPE_U`, make sure CMake is not including system paths. |