Reorganising build.gradle for CUDA 12

Signed-off-by: brian <brian@brutex.de>
CUDA12
Brian Rosenberger 2023-08-28 16:49:40 +02:00
parent 4d582263f0
commit 667000df5b
2 changed files with 14 additions and 22 deletions

View File

@ -39,7 +39,6 @@ dependencies {
tasks.named("compileJava").configure { tasks.named("compileJava").configure {
dependsOn ":cavis-native:cavis-native-lib:javacppCudaSupportBuildParser", dependsOn ":cavis-native:cavis-native-lib:javacppCudaSupportBuildParser",
":cavis-native:cavis-native-lib:compileCudaGeneratedJava"
":cavis-native:cavis-native-lib:cudaJar" ":cavis-native:cavis-native-lib:cudaJar"
} }

View File

@ -71,20 +71,18 @@ plugins {
} }
chipList.each {String thisChip -> chipList.each {String thisChip ->
sourceSets.register(thisChip) { /*sourceSets.register(thisChip) {
java { java {
srcDirs = ["${projectDir}/src/main/java/"] srcDirs = ["${projectDir}/src/main/java/"]
include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Helper.java" include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Helper.java"
include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java" include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java"
} }
java.destinationDirectory.set(file("${projectDir}/build/classes/java/main/")) }*/
} sourceSets.register("${thisChip}") {
sourceSets.register("${thisChip}Generated") {
java { java {
srcDirs = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"] srcDirs = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
include "org/nd4j/nativeblas/Nd4j${thisChip.capitalize()}.java" 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 "org.bytedeco:javacpp::${javacppPlatform}"
cudaImplementation project(":cavis-native:cavis-native-cuda-presets") cudaImplementation project(":cavis-native:cavis-native-cuda-presets")
cudaGeneratedImplementation platform(project(':cavis-common-platform')) //cudaGeneratedImplementation platform(project(':cavis-common-platform'))
cudaGeneratedImplementation project(":cavis-native:cavis-native-blas") //cudaGeneratedImplementation project(":cavis-native:cavis-native-blas")
cudaGeneratedImplementation "org.bytedeco:javacpp" //cudaGeneratedImplementation "org.bytedeco:javacpp"
cudaGeneratedImplementation "org.bytedeco:javacpp::${javacppPlatform}" //cudaGeneratedImplementation "org.bytedeco:javacpp::${javacppPlatform}"
cudaGeneratedImplementation project(":cavis-native:cavis-native-cuda-presets") //cudaGeneratedImplementation project(":cavis-native:cavis-native-cuda-presets")
} }
if(withCpu()) { if(withCpu()) {
@ -235,7 +233,7 @@ chipList.each { String thisChip ->
if (line.contains("=")) { if (line.contains("=")) {
def parts = line.split("=") def parts = line.split("=")
it.environmentVariables.put(parts[0], parts[1]) 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()}"] classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"]
configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}") configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}")
classPath = sourceSets.named("${thisChip}Generated").get().compileClasspath.collect() classPath = sourceSets.named("${thisChip}").get().compileClasspath.collect()
classPath += "${buildDir}/classes/java/main/" classPath += "${buildDir}/classes/java/${thisChip}/"
} }
// Create Jar with classifier // Create Jar with classifier
@ -373,9 +371,6 @@ chipList.each { String thisChip ->
from(sourceSets.named(thisChip).get().getOutput()) { from(sourceSets.named(thisChip).get().getOutput()) {
into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands 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 duplicatesStrategy DuplicatesStrategy.EXCLUDE
} }
@ -390,6 +385,9 @@ tasks.named("compileJava").configure {enabled false}
chipList.each { String thisChip -> chipList.each { String thisChip ->
tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure { tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure {
dependsOn "compile${thisChip.capitalize()}Java"
}
tasks.named("compile${thisChip.capitalize()}Java").configure {
dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser" dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
} }
@ -397,11 +395,6 @@ chipList.each { String thisChip ->
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCommand" 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 { tasks.named("${thisChip}Jar").configure {
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler" dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"