Reorganising build.gradle for CUDA 12

Signed-off-by: brian <brian@brutex.de>
CUDA12
Brian Rosenberger 2023-08-29 13:04:55 +02:00
parent 54efcb8d47
commit 48f20f1f27
2 changed files with 14 additions and 6 deletions

View File

@ -49,4 +49,10 @@ public class LoadBackendTests {
Number n = res.sumNumber(); Number n = res.sumNumber();
assertEquals(n.doubleValue(), 7.0, String.format("Addition of two scalar values %g and %g", d1, d2)); assertEquals(n.doubleValue(), 7.0, String.format("Addition of two scalar values %g and %g", d1, d2));
} }
@Test
public void loadCudaDLL() {
System.load(
"C:\\Users\\brian\\_projects\\deeplearning4j\\cavis-native\\cavis-native-lib\\build\\generated\\sources\\javacpp\\cuda\\windows-x86_64-avx2\\jni_nd4jcuda.dll");
}
} }

View File

@ -65,7 +65,7 @@ buildscript {
plugins { plugins {
id 'java-library' id 'java-library'
id 'org.bytedeco.gradle-javacpp-build' version "1.5.9" //version "1.5.10-SNAPSHOT" id 'org.bytedeco.gradle-javacpp-build' version "1.5.10-SNAPSHOT" //version "1.5.10-SNAPSHOT"
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
} }
@ -78,7 +78,7 @@ chipList.each {String thisChip ->
include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java" include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java"
} }
}*/ }*/
sourceSets.register("${thisChip}") { sourceSets.register("${thisChip}").configure {
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"
@ -96,7 +96,9 @@ sourceSets {
} }
} }
} }
*/
*/
// This block registers the cpu and cuda features and creates // This block registers the cpu and cuda features and creates
@ -294,9 +296,6 @@ 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) {org.bytedeco.gradle.javacpp.BuildTask it -> 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")) {
enabled = false
}
linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"] linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"]
includePath = ["${projectDir}/src/main/cpp/blas/", includePath = ["${projectDir}/src/main/cpp/blas/",
@ -389,6 +388,9 @@ chipList.each { String thisChip ->
tasks.named("compileJava").configure {enabled false} tasks.named("compileJava").configure {enabled false}
chipList.each { String thisChip -> chipList.each { String thisChip ->
tasks.named("build").configure {
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"
}
tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure { tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure {
dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser" dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
} }