Reorganising build.gradle for CUDA 12

Signed-off-by: brian <brian@brutex.de>
CUDA12
Brian Rosenberger 2023-08-28 11:54:32 +02:00
parent 2c0c3d01a0
commit 0eb56ef45f
3 changed files with 15 additions and 15 deletions

View File

@ -128,7 +128,7 @@ import java.util.List;
"cnpy/cnpy.h" "cnpy/cnpy.h"
}, },
compiler = {"cpp11", "nowarnings"}, compiler = {"cpp11", "nowarnings"},
library = "jnind4jcuda", library = "jni_nd4jcuda",
link = "nd4jcuda"), link = "nd4jcuda"),
@Platform(value = "linux", preload = "gomp@.1", preloadpath = {"/lib64/", "/lib/", "/usr/lib64/", "/usr/lib/", "/usr/local/cuda/lib64"}), @Platform(value = "linux", preload = "gomp@.1", preloadpath = {"/lib64/", "/lib/", "/usr/lib64/", "/usr/lib/", "/usr/local/cuda/lib64"}),

View File

@ -41,6 +41,7 @@ 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:compileCudaGeneratedJava"
":cavis-native:cavis-native-lib:cudaJar"
} }

View File

@ -290,20 +290,19 @@ chipList.each { String thisChip ->
// Generates jnijavacpp.cpp and jniNativeLibrary.cpp, compiles and links it // Generates jnijavacpp.cpp and jniNativeLibrary.cpp, compiles and links it
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCompiler", org.bytedeco.gradle.javacpp.BuildTask) { tasks.register("javacpp${thisChip.capitalize()}SupportBuildCompiler", org.bytedeco.gradle.javacpp.BuildTask) {org.bytedeco.gradle.javacpp.BuildTask it ->
if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) { if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) {
enabled = false enabled = false
} }
def thisTask = (org.bytedeco.gradle.javacpp.BuildTask) it
thisTask.linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"] linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"]
thisTask.includePath = ["${projectDir}/src/main/cpp/blas/", includePath = ["${projectDir}/src/main/cpp/blas/",
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/", "${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/",
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/flatbuffers-src/include", "${projectDir}/blasbuild/${thisChip}/${avxExtension}/flatbuffers-src/include",
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/cpu_features-src/include", "${projectDir}/blasbuild/${thisChip}/${avxExtension}/cpu_features-src/include",
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/mkldnn-src/include"] "${projectDir}/blasbuild/${thisChip}/${avxExtension}/mkldnn-src/include"]
thisTask.properties = getBuildPlatform( thisChip, thisTask ) properties = getBuildPlatform( thisChip, it )
if(thisChip.equals('cuda') && osdetector.os.startsWith("win") && project.hasProperty("skip-native") if(thisChip.equals('cuda') && osdetector.os.startsWith("win") && project.hasProperty("skip-native")
&& !project.getProperty("skip-native").equals("true") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) { && !project.getProperty("skip-native").equals("true") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) {
@ -339,16 +338,16 @@ chipList.each { String thisChip ->
} }
thisTask.buildPath = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"] buildPath = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
thisTask.copyLibs = true copyLibs = true
thisTask.deleteJniFiles(false) deleteJniFiles(false)
outputName = "jnind4j${thisChip}" //outputName = "jnind4j${thisChip}"
thisTask.outputDirectory = file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/") outputDirectory = file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
thisTask.classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"] classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"]
thisTask.configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}") configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}")
thisTask.classPath = sourceSets.named("${thisChip}Generated").get().compileClasspath.collect() classPath = sourceSets.named("${thisChip}Generated").get().compileClasspath.collect()
thisTask.classPath += "${buildDir}/classes/java/main/" classPath += "${buildDir}/classes/java/main/"
} }
// Create Jar with classifier // Create Jar with classifier