From 48f20f1f27ede17be1697bc3a87647e0efe7c1f3 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 29 Aug 2023 13:04:55 +0200 Subject: [PATCH] Reorganising build.gradle for CUDA 12 Signed-off-by: brian --- .../net/brutex/ai/nd4j/tests/LoadBackendTests.java | 6 ++++++ cavis-native/cavis-native-lib/build.gradle | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/brutex-extended-tests/src/test/java/net/brutex/ai/nd4j/tests/LoadBackendTests.java b/brutex-extended-tests/src/test/java/net/brutex/ai/nd4j/tests/LoadBackendTests.java index 2410eaf2a..bb03a4fb9 100644 --- a/brutex-extended-tests/src/test/java/net/brutex/ai/nd4j/tests/LoadBackendTests.java +++ b/brutex-extended-tests/src/test/java/net/brutex/ai/nd4j/tests/LoadBackendTests.java @@ -49,4 +49,10 @@ public class LoadBackendTests { Number n = res.sumNumber(); 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"); + } } diff --git a/cavis-native/cavis-native-lib/build.gradle b/cavis-native/cavis-native-lib/build.gradle index 7d8cd3b3c..90585cead 100644 --- a/cavis-native/cavis-native-lib/build.gradle +++ b/cavis-native/cavis-native-lib/build.gradle @@ -65,7 +65,7 @@ buildscript { plugins { 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 'signing' } @@ -78,7 +78,7 @@ chipList.each {String thisChip -> include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java" } }*/ - sourceSets.register("${thisChip}") { + sourceSets.register("${thisChip}").configure { java { srcDirs = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"] include "org/nd4j/nativeblas/Nd4j${thisChip.capitalize()}.java" @@ -96,7 +96,9 @@ sourceSets { } } } -*/ + + */ + // 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 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"] includePath = ["${projectDir}/src/main/cpp/blas/", @@ -389,6 +388,9 @@ chipList.each { String thisChip -> tasks.named("compileJava").configure {enabled false} chipList.each { String thisChip -> + tasks.named("build").configure { + dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler" + } tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure { dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser" }