From 2c0c3d01a0e377f220578b5595bffc92894d07e0 Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 28 Aug 2023 11:39:46 +0200 Subject: [PATCH] Reorganising build.gradle for CUDA 12 Signed-off-by: brian --- .../main/java/org/nd4j/nativeblas/cuda/Nd4jCudaPresets.java | 4 ++-- .../java/org/nd4j/jita/constant/CudaConstantHandler.java | 1 - cavis-native/cavis-native-lib/CMakeLists.txt | 2 ++ cavis-native/cavis-native-lib/build.gradle | 5 ++++- .../cavis-native-lib/src/main/cpp/blas/CMakeLists.txt | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cavis-native/cavis-native-cuda-presets/src/main/java/org/nd4j/nativeblas/cuda/Nd4jCudaPresets.java b/cavis-native/cavis-native-cuda-presets/src/main/java/org/nd4j/nativeblas/cuda/Nd4jCudaPresets.java index ce3bde752..1fc3c7404 100644 --- a/cavis-native/cavis-native-cuda-presets/src/main/java/org/nd4j/nativeblas/cuda/Nd4jCudaPresets.java +++ b/cavis-native/cavis-native-cuda-presets/src/main/java/org/nd4j/nativeblas/cuda/Nd4jCudaPresets.java @@ -134,8 +134,8 @@ import java.util.List; @Platform(value = "linux", preload = "gomp@.1", preloadpath = {"/lib64/", "/lib/", "/usr/lib64/", "/usr/lib/", "/usr/local/cuda/lib64"}), @Platform(value = "linux-armhf", preloadpath = {"/usr/arm-linux-gnueabihf/lib/", "/usr/lib/arm-linux-gnueabihf/"}), @Platform(value = "linux-arm64", preloadpath = {"/usr/aarch64-linux-gnu/lib/", "/usr/lib/aarch64-linux-gnu/"}), - @Platform(value = "linux-ppc64", preloadpath = {"/usr/powerpc64-linux-gnu/lib/", "/usr/powerpc64le-linux-gnu/lib/", "/usr/lib/powerpc64-linux-gnu/", "/usr/lib/powerpc64le-linux-gnu/"}) - //@Platform(value = "windows", preload = {"libwinpthread-1", "libgcc_s_seh-1", "libgomp-1", "libstdc++-6", "nd4jcuda"}) + @Platform(value = "linux-ppc64", preloadpath = {"/usr/powerpc64-linux-gnu/lib/", "/usr/powerpc64le-linux-gnu/lib/", "/usr/lib/powerpc64-linux-gnu/", "/usr/lib/powerpc64le-linux-gnu/"}), + @Platform(value = "windows", preload = {"libwinpthread-1", "libgcc_s_seh-1", "libgomp-1", "libstdc++-6", "nd4jcuda"}) }) public class Nd4jCudaPresets implements LoadEnabled, InfoMapper { diff --git a/cavis-native/cavis-native-jcublas/src/main/java/org/nd4j/jita/constant/CudaConstantHandler.java b/cavis-native/cavis-native-jcublas/src/main/java/org/nd4j/jita/constant/CudaConstantHandler.java index cf329176b..b7b94cfe3 100644 --- a/cavis-native/cavis-native-jcublas/src/main/java/org/nd4j/jita/constant/CudaConstantHandler.java +++ b/cavis-native/cavis-native-jcublas/src/main/java/org/nd4j/jita/constant/CudaConstantHandler.java @@ -20,7 +20,6 @@ package org.nd4j.jita.constant; -import lombok.extern.log4j.Log4j2; import lombok.extern.slf4j.Slf4j; import org.nd4j.linalg.api.buffer.DataBuffer; import org.nd4j.linalg.api.buffer.DataType; diff --git a/cavis-native/cavis-native-lib/CMakeLists.txt b/cavis-native/cavis-native-lib/CMakeLists.txt index 4427e26b3..271c5f3bd 100644 --- a/cavis-native/cavis-native-lib/CMakeLists.txt +++ b/cavis-native/cavis-native-lib/CMakeLists.txt @@ -24,6 +24,8 @@ option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler" OF set(FLATBUFFERS_BUILD_FLATC "OFF" CACHE STRING "Hack to disable flatc build" FORCE) set(CMAKE_CXX_STANDARD 14) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) #/////////////////////////////////////////////////////////////////////////////// # genCompilation: Generates cpp, cu files diff --git a/cavis-native/cavis-native-lib/build.gradle b/cavis-native/cavis-native-lib/build.gradle index cdfe480c3..2ec858b2a 100644 --- a/cavis-native/cavis-native-lib/build.gradle +++ b/cavis-native/cavis-native-lib/build.gradle @@ -352,7 +352,7 @@ chipList.each { String thisChip -> } // Create Jar with classifier - tasks.getByName("${thisChip}Jar") { Jar thisTask -> + tasks.named("${thisChip}Jar").configure { Jar thisTask -> dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler" dependsOn "javacpp${thisChip.capitalize()}SupportBuildCommand" @@ -374,6 +374,9 @@ chipList.each { String thisChip -> from(sourceSets.named(thisChip).get().getOutput()) { into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands } + from(sourceSets.named("${thisChip}Generated").get().getOutput()) { + into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands + } duplicatesStrategy DuplicatesStrategy.EXCLUDE } 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 2ec6b11a4..9df87de12 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 @@ -331,7 +331,7 @@ if(SD_CUDA) endif() #target_link_libraries(${SD_LIBRARY_NAME} ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN}) - target_link_libraries(${SD_LIBRARY_NAME} CUDA::cudart CUDA::cublas CUDA::cusolver CUDA::cublasLt ${CUDNN} ${MKLDNN}) + target_link_libraries(${SD_LIBRARY_NAME} CUDA::cudart CUDA::cublas CUDA::cusolver CUDA::cublasLt Threads::Threads ${CUDNN} ${MKLDNN}) #target_link_libraries(${SD_LIBRARY_NAME} ${CUDNN} ${MKLDNN}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/cuda/${SD_EXTENSION})