Reorganising build.gradle for CUDA 12

Signed-off-by: brian <brian@brutex.de>
CUDA12
Brian Rosenberger 2023-08-29 18:23:36 +02:00
parent 7b73b05002
commit 9d1fb9a279
2 changed files with 8 additions and 4 deletions

View File

@ -449,13 +449,13 @@ elseif(SD_CPU)
#This breaks the build. Normally you want to run tests anyways. #This breaks the build. Normally you want to run tests anyways.
if(NOT "$ENV{CLION_IDE}") 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() endif()
if ("${SD_ALL_OPS}" AND "${SD_BUILD_MINIFIER}") if ("${SD_ALL_OPS}" AND "${SD_BUILD_MINIFIER}")
message(STATUS "Building minifier...") message(STATUS "Building minifier...")
add_executable(minifier ../minifier/minifier.cpp ../minifier/graphopt.cpp) 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() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.9) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.9)

View File

@ -21,6 +21,10 @@ if(WIN32)
endforeach() endforeach()
endif() endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
if (SD_CUDA) if (SD_CUDA)
find_package(CUDAToolkit 12.2 REQUIRED) find_package(CUDAToolkit 12.2 REQUIRED)
enable_language(CUDA) enable_language(CUDA)
@ -150,7 +154,7 @@ if (SD_CPU)
endif() endif()
add_executable(runtests ${TEST_SOURCES}) 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) elseif(SD_CUDA)
add_executable(runtests ${TEST_SOURCES}) add_executable(runtests ${TEST_SOURCES})
@ -168,5 +172,5 @@ elseif(SD_CUDA)
message("CUDNN library: ${CUDNN}") message("CUDNN library: ${CUDNN}")
endif() 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() endif()