From 667000df5b06d29db53e7c24d96a478513999513 Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 28 Aug 2023 16:49:40 +0200 Subject: [PATCH] Reorganising build.gradle for CUDA 12 Signed-off-by: brian --- .../cavis-native-jcublas/build.gradle | 1 - cavis-native/cavis-native-lib/build.gradle | 35 ++++++++----------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/cavis-native/cavis-native-jcublas/build.gradle b/cavis-native/cavis-native-jcublas/build.gradle index fab5c31d0..641010f14 100644 --- a/cavis-native/cavis-native-jcublas/build.gradle +++ b/cavis-native/cavis-native-jcublas/build.gradle @@ -39,7 +39,6 @@ dependencies { tasks.named("compileJava").configure { dependsOn ":cavis-native:cavis-native-lib:javacppCudaSupportBuildParser", - ":cavis-native:cavis-native-lib:compileCudaGeneratedJava" ":cavis-native:cavis-native-lib:cudaJar" } diff --git a/cavis-native/cavis-native-lib/build.gradle b/cavis-native/cavis-native-lib/build.gradle index d6f6704a8..b06278c1c 100644 --- a/cavis-native/cavis-native-lib/build.gradle +++ b/cavis-native/cavis-native-lib/build.gradle @@ -71,20 +71,18 @@ plugins { } chipList.each {String thisChip -> - sourceSets.register(thisChip) { + /*sourceSets.register(thisChip) { java { srcDirs = ["${projectDir}/src/main/java/"] include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Helper.java" include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java" } - java.destinationDirectory.set(file("${projectDir}/build/classes/java/main/")) - } - sourceSets.register("${thisChip}Generated") { + }*/ + sourceSets.register("${thisChip}") { java { srcDirs = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"] include "org/nd4j/nativeblas/Nd4j${thisChip.capitalize()}.java" } - java.destinationDirectory.set(file("${projectDir}/build/classes/java/main/")) } } @@ -134,11 +132,11 @@ dependencies { cudaImplementation "org.bytedeco:javacpp::${javacppPlatform}" cudaImplementation project(":cavis-native:cavis-native-cuda-presets") - cudaGeneratedImplementation platform(project(':cavis-common-platform')) - cudaGeneratedImplementation project(":cavis-native:cavis-native-blas") - cudaGeneratedImplementation "org.bytedeco:javacpp" - cudaGeneratedImplementation "org.bytedeco:javacpp::${javacppPlatform}" - cudaGeneratedImplementation project(":cavis-native:cavis-native-cuda-presets") + //cudaGeneratedImplementation platform(project(':cavis-common-platform')) + //cudaGeneratedImplementation project(":cavis-native:cavis-native-blas") + //cudaGeneratedImplementation "org.bytedeco:javacpp" + //cudaGeneratedImplementation "org.bytedeco:javacpp::${javacppPlatform}" + //cudaGeneratedImplementation project(":cavis-native:cavis-native-cuda-presets") } if(withCpu()) { @@ -235,7 +233,7 @@ chipList.each { String thisChip -> if (line.contains("=")) { def parts = line.split("=") it.environmentVariables.put(parts[0], parts[1]) - logger.quiet("Added variable to environment: {} = {}", parts[0], parts[1]) + logger.debug("Added variable to environment: {} = {}", parts[0], parts[1]) } } } @@ -346,8 +344,8 @@ chipList.each { String thisChip -> classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"] configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}") - classPath = sourceSets.named("${thisChip}Generated").get().compileClasspath.collect() - classPath += "${buildDir}/classes/java/main/" + classPath = sourceSets.named("${thisChip}").get().compileClasspath.collect() + classPath += "${buildDir}/classes/java/${thisChip}/" } // Create Jar with classifier @@ -373,9 +371,6 @@ 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 } @@ -390,6 +385,9 @@ tasks.named("compileJava").configure {enabled false} chipList.each { String thisChip -> tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure { + dependsOn "compile${thisChip.capitalize()}Java" + } + tasks.named("compile${thisChip.capitalize()}Java").configure { dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser" } @@ -397,11 +395,6 @@ chipList.each { String thisChip -> dependsOn "javacpp${thisChip.capitalize()}SupportBuildCommand" } - tasks.named("javacpp${thisChip.capitalize()}SupportBuildCommand").configure { - dependsOn "process${thisChip.capitalize()}Resources", - "compile${thisChip.capitalize()}Java", - "compile${thisChip.capitalize()}GeneratedJava" - } tasks.named("${thisChip}Jar").configure { dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"