From 9d1fb9a279c97bf402f28e3f9664c33a0c5c315a Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 29 Aug 2023 18:23:36 +0200 Subject: [PATCH] Reorganising build.gradle for CUDA 12 Signed-off-by: brian --- .../cavis-native-lib/src/main/cpp/blas/CMakeLists.txt | 4 ++-- .../src/test/cpp/tests_cpu/layers_tests/CMakeLists.txt | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt b/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt index d33caee06..c7728c958 100644 --- a/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt +++ b/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt @@ -449,13 +449,13 @@ elseif(SD_CPU) #This breaks the build. Normally you want to run tests anyways. if(NOT "$ENV{CLION_IDE}") - target_link_libraries(${SD_LIBRARY_NAME} ${MKLDNN} ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${BLAS_LIBRARIES} ${CPU_FEATURES}) + target_link_libraries(${SD_LIBRARY_NAME} Threads::Threads ${MKLDNN} ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${BLAS_LIBRARIES} ${CPU_FEATURES}) endif() if ("${SD_ALL_OPS}" AND "${SD_BUILD_MINIFIER}") message(STATUS "Building minifier...") add_executable(minifier ../minifier/minifier.cpp ../minifier/graphopt.cpp) - target_link_libraries(minifier samediff_obj ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES}) + target_link_libraries(minifier samediff_obj Threads::Threads ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES}) endif() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.9) diff --git a/cavis-native/cavis-native-lib/src/test/cpp/tests_cpu/layers_tests/CMakeLists.txt b/cavis-native/cavis-native-lib/src/test/cpp/tests_cpu/layers_tests/CMakeLists.txt index fd8a70f9e..5afbc854a 100644 --- a/cavis-native/cavis-native-lib/src/test/cpp/tests_cpu/layers_tests/CMakeLists.txt +++ b/cavis-native/cavis-native-lib/src/test/cpp/tests_cpu/layers_tests/CMakeLists.txt @@ -21,6 +21,10 @@ if(WIN32) endforeach() endif() +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) +find_package(Threads REQUIRED) + if (SD_CUDA) find_package(CUDAToolkit 12.2 REQUIRED) enable_language(CUDA) @@ -150,7 +154,7 @@ if (SD_CPU) endif() add_executable(runtests ${TEST_SOURCES}) - target_link_libraries(runtests samediff_obj ${MKLDNN_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES} ${ARMCOMPUTE_LIBRARIES} gtest gtest_main) + target_link_libraries(runtests samediff_obj Threads::Threads ${MKLDNN_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES} ${ARMCOMPUTE_LIBRARIES} gtest gtest_main) elseif(SD_CUDA) add_executable(runtests ${TEST_SOURCES}) @@ -168,5 +172,5 @@ elseif(SD_CUDA) message("CUDNN library: ${CUDNN}") endif() - target_link_libraries(runtests samediff_obj ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN} gtest gtest_main) + target_link_libraries(runtests samediff_obj Threads::Threads ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN} gtest gtest_main) endif() \ No newline at end of file