parent
a63bee1b94
commit
150133602b
|
@ -24,6 +24,7 @@ package net.brutex.ai.nd4j.tests;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bytedeco.javacpp.Loader;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nd4j.linalg.api.environment.Nd4jEnvironment;
|
||||
import org.nd4j.linalg.api.ndarray.INDArray;
|
||||
import org.nd4j.linalg.factory.Nd4j;
|
||||
|
||||
|
@ -38,16 +39,7 @@ public class LoadBackendTests {
|
|||
|
||||
@Test
|
||||
public void loadBackend() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
// check if Nd4j is there
|
||||
Logger.getLogger(LoadBackendTests.class.getName()).info("System java.library.path: " +
|
||||
System.getProperty("java.library.path"));
|
||||
// final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
|
||||
// sysPathsField.setAccessible(true);
|
||||
// sysPathsField.set(null, null);
|
||||
// System.loadLibrary("jnind4jcuda");
|
||||
//Loader.load();
|
||||
//Loader.loadGlobal("nd4jcuda.dll");
|
||||
//log.info("Loaded directly, complete.");
|
||||
log.info("get number of GPUs {}", Nd4jEnvironment.getEnvironment().getNumGpus());
|
||||
log.info("Backend: {}", Nd4j.getBackend().buildInfo());
|
||||
double d1 = 2.0;
|
||||
double d2 = 5.0;
|
||||
|
|
|
@ -23,7 +23,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.6.0"
|
||||
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.8.0"
|
||||
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ dependencies {
|
|||
|
||||
|
||||
constraints {
|
||||
api enforcedPlatform("io.netty:netty-bom:${netty.version}")
|
||||
api enforcedPlatform("com.fasterxml.jackson:jackson-bom:${jackson.version}")
|
||||
api enforcedPlatform("com.squareup.okhttp3:okhttp-bom:${okhttp3.version}")
|
||||
api ("io.netty:netty-bom:${netty.version}")
|
||||
api ("com.fasterxml.jackson:jackson-bom:${jackson.version}")
|
||||
api ("com.squareup.okhttp3:okhttp-bom:${okhttp3.version}")
|
||||
|
||||
api 'com.google.guava:guava:30.1-jre'
|
||||
api "com.google.protobuf:protobuf-java:3.15.6"
|
||||
|
@ -105,6 +105,7 @@ dependencies {
|
|||
api "org.bytedeco:javacv:${javacv.version}"
|
||||
api "org.bytedeco:opencv:${opencv.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:openblas:${openblas.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:openblas-platform:${openblas.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:leptonica-platform:${leptonica.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:hdf5-platform:${hdf5.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:hdf5:${hdf5.version}-${javacpp.presetsVersion}"
|
||||
|
|
|
@ -19,5 +19,4 @@
|
|||
#
|
||||
#
|
||||
|
||||
#org.nd4j.linalg.jcublas.JCublasBackend
|
||||
org.nd4j.linalg.cpu.nativecpu.CpuBackend
|
|
@ -13,7 +13,7 @@ dependencies {
|
|||
implementation projects.cavisNative.cavisNativeCommon
|
||||
implementation projects.cavisDnn.cavisDnnApi
|
||||
implementation projects.cavisDnn.cavisDnnCommon
|
||||
|
||||
implementation projects.cavisNative.cavisNativeCpuPresets
|
||||
|
||||
implementation (projects.cavisNative.cavisNativeLib) {
|
||||
capabilities {
|
||||
|
|
|
@ -10,22 +10,24 @@ ext {
|
|||
|
||||
dependencies {
|
||||
implementation platform(projects.cavisCommonPlatform)
|
||||
|
||||
//implementation project(":cavis-native:cavis-native-blas")
|
||||
implementation projects.cavisNative.cavisNativeBlas
|
||||
|
||||
implementation group: "org.bytedeco", name: "cuda"
|
||||
implementation group: "org.bytedeco", name: "cuda", classifier: buildTarget
|
||||
implementation group: "org.bytedeco", name: "cuda", classifier: "${buildTarget}-redist"
|
||||
//implementation group: "org.bytedeco", name: "cuda", classifier: "${buildTarget}-redist"
|
||||
|
||||
implementation group: "org.bytedeco", name: "javacpp"
|
||||
implementation group: "org.bytedeco", name: "javacpp", classifier: buildTarget
|
||||
|
||||
implementation(project(path: ":cavis-native:cavis-native-lib")) {
|
||||
implementation projects.cavisNative.cavisNativeCudaPresets
|
||||
|
||||
//implementation name: "cavis-native:cavis-native-lib", configuration: "cuda"
|
||||
implementation(project(":cavis-native:cavis-native-lib")) {
|
||||
capabilities {
|
||||
it.requireCapability(group: "net.brutex.cavis.cavis-native", name: "cavis-native-lib-cuda-support", version:project.version)
|
||||
requireCapability("${project.group}:cavis-native-lib-cuda-support:${project.version}")
|
||||
}
|
||||
}
|
||||
|
||||
implementation project(":cavis-native:cavis-native-common")
|
||||
implementation project(":cavis-dnn:cavis-dnn-api")
|
||||
implementation project(":cavis-dnn:cavis-dnn-common")
|
||||
|
@ -36,3 +38,9 @@ dependencies {
|
|||
implementation "org.apache.commons:commons-lang3"
|
||||
}
|
||||
|
||||
tasks.named("compileJava").configure {
|
||||
dependsOn ":cavis-native:cavis-native-lib:javacppCudaSupportBuildParser",
|
||||
":cavis-native:cavis-native-lib:compileCudaGeneratedJava"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import org.gradle.api.internal.java.DefaultJavaPlatformExtension
|
||||
import org.gradle.api.plugins.internal.DefaultJavaPluginExtension
|
||||
import org.gradle.api.publish.maven.internal.publisher.MavenRemotePublisher
|
||||
import org.gradle.language.nativeplatform.internal.Dimensions
|
||||
|
||||
|
@ -44,8 +46,7 @@ buildscript {
|
|||
logger.info("Setting properties for task '{}' to '{}'", tsk.getName(), pf)
|
||||
return pf
|
||||
}
|
||||
|
||||
}
|
||||
} // End of ext block
|
||||
|
||||
|
||||
dependencies {
|
||||
|
@ -64,104 +65,101 @@ buildscript {
|
|||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'org.bytedeco.gradle-javacpp-build' version "1.5.9"
|
||||
id 'org.bytedeco.gradle-javacpp-build' version "1.5.10-SNAPSHOT"
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
}
|
||||
|
||||
chipList.each {thisChip ->
|
||||
sourceSets.register("${thisChip}Support") {
|
||||
chipList.each {String thisChip ->
|
||||
sourceSets.register(thisChip) {
|
||||
java {
|
||||
srcDirs = ['src/main/java', "${buildDir}/generated/sources/javacpp/${thisChip}//${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
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") {
|
||||
java {
|
||||
srcDirs = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
include "org/nd4j/nativeblas/Nd4j${thisChip.capitalize()}.java"
|
||||
}
|
||||
it.compiledBy("javacpp${thisChip.capitalize()}SupportBuildCommand",
|
||||
"javacpp${thisChip.capitalize()}SupportBuildCompiler")
|
||||
java.destinationDirectory.set(file("${projectDir}/build/classes/java/main/"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if(osdetector.os.startsWith("windows")) {
|
||||
/*
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ['src/main/java']
|
||||
srcDirs = new HashSet<>();
|
||||
include 'org/nd4j/nativeblas/Dummy.java'
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
*/
|
||||
|
||||
|
||||
// This block registers the cpu and cuda features and creates
|
||||
// i. e. the {chip}Implementation
|
||||
java {
|
||||
chipList.each {thisChip ->
|
||||
registerFeature("${thisChip}Support") {
|
||||
usingSourceSet(sourceSets.findByName("${thisChip}Support"))
|
||||
usingSourceSet(sourceSets.findByName("${thisChip}"))
|
||||
capability(project.group, "cavis-native-lib-${thisChip}-support", project.version)
|
||||
//withJavadocJar()
|
||||
//withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
dependencies {
|
||||
api platform(project(':cavis-common-platform'))
|
||||
implementation "org.bytedeco:javacpp"
|
||||
implementation group: "org.bytedeco", name: "javacpp", classifier: "${javacppPlatform}"
|
||||
|
||||
if(withCuda()) {
|
||||
cudaSupportImplementation platform(project(':cavis-common-platform'))
|
||||
cudaSupportImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
cudaSupportImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cudaSupportImplementation project(":cavis-native:cavis-native-blas")
|
||||
cudaSupportImplementation project(":cavis-native:cavis-native-common")
|
||||
cudaSupportImplementation "commons-io:commons-io"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "openblas"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "openblas", classifier: "${javacppPlatform}"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "cuda"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "cuda", classifier: "${javacppPlatform}"
|
||||
cudaSupportImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
cudaSupportImplementation "com.google.guava:guava:14.0.1"
|
||||
cudaSupportImplementation "org.apache.commons:commons-lang3"
|
||||
cudaSupportImplementation "org.apache.commons:commons-math3"
|
||||
cudaSupportImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
cudaSupportImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
cudaImplementation platform(project(':cavis-common-platform'))
|
||||
|
||||
//cudaImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
//cudaImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cudaImplementation project(":cavis-native:cavis-native-blas")
|
||||
//cudaImplementation project(":cavis-native:cavis-native-common")
|
||||
//cudaImplementation "commons-io:commons-io"
|
||||
//cudaImplementation "org.bytedeco:openblas"
|
||||
//cudaImplementation "org.bytedeco:openblas::${javacppPlatform}"
|
||||
//cudaImplementation "org.bytedeco:cuda"
|
||||
//cudaImplementation "org.bytedeco:cuda::${javacppPlatform}"
|
||||
//cudaImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
//cudaImplementation "com.google.guava:guava:14.0.1"
|
||||
//cudaImplementation "org.apache.commons:commons-lang3"
|
||||
//cudaImplementation "org.apache.commons:commons-math3"
|
||||
//cudaImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
//cudaImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
cudaImplementation "org.bytedeco:javacpp"
|
||||
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")
|
||||
}
|
||||
|
||||
if(withCpu()) {
|
||||
cpuSupportImplementation platform(project(':cavis-common-platform'))
|
||||
cpuSupportImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
cpuSupportImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cpuSupportImplementation project(":cavis-native:cavis-native-blas")
|
||||
cpuSupportImplementation project(":cavis-native:cavis-native-common")
|
||||
cpuSupportImplementation "commons-io:commons-io"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "openblas"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "openblas", classifier: "${javacppPlatform}"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "opencv"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "opencv", classifier: "${javacppPlatform}"
|
||||
cpuSupportImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
cpuSupportImplementation "com.google.guava:guava:14.0.1"
|
||||
cpuSupportImplementation "org.apache.commons:commons-lang3"
|
||||
cpuSupportImplementation "org.apache.commons:commons-math3"
|
||||
cpuSupportImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
cpuSupportImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
cpuImplementation platform(project(':cavis-common-platform'))
|
||||
//cpuImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
//cpuImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
//cpuImplementation project(":cavis-native:cavis-native-blas")
|
||||
//cpuImplementation project(":cavis-native:cavis-native-common")
|
||||
//cpuImplementation "commons-io:commons-io"
|
||||
//cpuImplementation "org.bytedeco:opencv"
|
||||
//cpuImplementation "org.bytedeco:opencv::${javacppPlatform}"
|
||||
//cpuImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
//cpuImplementation "com.google.guava:guava:14.0.1"
|
||||
//cpuImplementation "org.apache.commons:commons-lang3"
|
||||
//cpuImplementation "org.apache.commons:commons-math3"
|
||||
//cpuImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
//cpuImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
//cpuImplementation "org.bytedeco:javacpp"
|
||||
//cpuImplementation "org.bytedeco:javacpp::${javacppPlatform}"
|
||||
cpuImplementation project(":cavis-native:cavis-native-cpu-presets")
|
||||
}
|
||||
|
||||
implementation projects.cavisDnn.cavisDnnApi
|
||||
implementation projects.cavisDnn.cavisDnnCommon
|
||||
implementation project(":cavis-native:cavis-native-blas")
|
||||
implementation project(":cavis-native:cavis-native-common")
|
||||
implementation "commons-io:commons-io"
|
||||
implementation "org.bytedeco:openblas"
|
||||
implementation group: "org.bytedeco", name: "openblas", classifier: "${javacppPlatform}"
|
||||
implementation "org.apache.logging.log4j:log4j-core"
|
||||
implementation "com.google.guava:guava:14.0.1"
|
||||
implementation "org.apache.commons:commons-lang3"
|
||||
implementation "org.apache.commons:commons-math3"
|
||||
implementation "com.google.flatbuffers:flatbuffers-java"
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,40 +181,31 @@ task deepClean(type: Delete) {
|
|||
}
|
||||
|
||||
|
||||
tasks.withType(org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
buildResource = [ "/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
tasks.withType(org.bytedeco.gradle.javacpp.BuildTask).configureEach { org.bytedeco.gradle.javacpp.BuildTask it ->
|
||||
it.buildResource = ["/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
"/org/bytedeco/mkldnn/${javacppPlatform}/"]
|
||||
|
||||
includeResource = ["/org/bytedeco/openblas/${javacppPlatform}/include/"]
|
||||
it.includeResource = ["/org/bytedeco/openblas/${javacppPlatform}/include/"]
|
||||
|
||||
linkResource = ["/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
it.linkResource = ["/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
"/org/bytedeco/openblas/${javacppPlatform}/lib/"]
|
||||
|
||||
//buildPath = [ org.bytedeco.javacpp.Loader.getCacheDir() ]
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Disable the standard javacpp generated tasks and use own
|
||||
// versions below. This allows to build for each variant
|
||||
|
||||
[javacppBuildParser, javacppBuildCommand, javacppCompileJava, javacppBuildCompiler].each {
|
||||
it.enabled false
|
||||
}
|
||||
|
||||
chipList.each { thisChip ->
|
||||
chipList.each { String thisChip ->
|
||||
|
||||
// 1)
|
||||
//Run the C++ compile first
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCommand", org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) {
|
||||
enabled = false
|
||||
}
|
||||
dependsOn "processResources"
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCommand", org.bytedeco.gradle.javacpp.BuildTask) {org.bytedeco.gradle.javacpp.BuildTask it ->
|
||||
properties = getBuildPlatform( thisChip, it )
|
||||
|
||||
|
||||
includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/flatbuffers-src/include",
|
||||
|
@ -226,13 +215,19 @@ chipList.each { thisChip ->
|
|||
//No idea why this is here, but it looks like even for the javacppBuildCommand task,
|
||||
//there is a javacpp Loader actively determining platform etc.
|
||||
classOrPackageNames = ["org.nd4j.nativeblas.${thisChip}.Nd4j${thisChip.capitalize()}Presets"]
|
||||
workingDirectory = projectDir
|
||||
//workingDirectory = projectDir
|
||||
//if the classpath is not set here, the javacpp classloader starts to look around
|
||||
//everywhere and causes java.io.IOExceptions: because files is being used by another process
|
||||
classPath = [:]
|
||||
classPath += ["${buildDir}/classes/java/${thisChip}Support/"]
|
||||
//classPath += ["${buildDir}/classes/java/main/"]
|
||||
//logger.quiet("Using compile classpath from configuration named '{}'", sourceSets.named(thisChip).get().getCompileClasspathConfigurationName())
|
||||
|
||||
classPath = sourceSets.named(thisChip).get().compileClasspath.collect()
|
||||
|
||||
|
||||
//tasks.named("compileCudaJava").get().getOutputs().files.each {System.out.println(it)}
|
||||
|
||||
System.out.println(it.name + ": INPUTS----------------")
|
||||
inputs.files.each {System.out.println(it)}
|
||||
System.out.println(it.name + ": INPUTS------------ENDE")
|
||||
/* Get VCVARS in case we want to build CUDA
|
||||
* MinGW64 g++ on MSYS is used otherwise */
|
||||
if (thisChip.equals('cuda') && osdetector.os.startsWith("win")
|
||||
|
@ -246,10 +241,11 @@ chipList.each { 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])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workingDirectory projectDir
|
||||
if (thisChip.equals('cuda') && osdetector.os.startsWith("windows")) { //cuDNN requires CUDA
|
||||
it.buildCommand = ['sh', 'buildnativeoperations.sh',
|
||||
'-V',
|
||||
|
@ -282,22 +278,10 @@ chipList.each { thisChip ->
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//Create a task to (pre)compile the java presets (required for javacppBuildParser)
|
||||
tasks.register("compile${thisChip.capitalize()}Support", JavaCompile) {
|
||||
def thisSS = sourceSets.findByName("${thisChip}Support")
|
||||
it.source = thisSS.allSource
|
||||
it.classpath = thisSS.compileClasspath
|
||||
it.destinationDirectory = file("${buildDir}/classes/java/${thisChip}Support/")
|
||||
}
|
||||
|
||||
//Run the parser on the InfoMap in Nd4j$ChipPresets and listed header files in @Platform
|
||||
//Generates Nd4jCpu.java and/ or Nd4jCuda.java Java JNI code
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildParser", org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) {
|
||||
enabled = false
|
||||
}
|
||||
dependsOn "compile${thisChip.capitalize()}Support"
|
||||
|
||||
|
||||
includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/",
|
||||
|
@ -305,13 +289,9 @@ chipList.each { thisChip ->
|
|||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/cpu_features-src/include",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/mkldnn-src/include"]
|
||||
|
||||
|
||||
|
||||
classOrPackageNames = ["org.nd4j.nativeblas.${thisChip}.Nd4j${thisChip.capitalize()}Presets"]
|
||||
outputDirectory = file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
|
||||
classPath = sourceSets.getByName("${thisChip}Support").getRuntimeClasspath()
|
||||
classPath += ["${buildDir}/classes/java/${thisChip}Support/"]
|
||||
classPath = sourceSets.named(thisChip).get().compileClasspath.collect()
|
||||
outputDirectory file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,7 +301,6 @@ chipList.each { thisChip ->
|
|||
enabled = false
|
||||
}
|
||||
def thisTask = (org.bytedeco.gradle.javacpp.BuildTask) it
|
||||
thisTask.dependsOn = ["javacpp${thisChip.capitalize()}SupportBuildParser"]
|
||||
|
||||
thisTask.linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"]
|
||||
thisTask.includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
|
@ -343,6 +322,7 @@ chipList.each { thisChip ->
|
|||
System.setProperty("org.bytedeco.javacpp.platform.compiler", cl)
|
||||
System.setProperty("platform.compiler.cpp11", cl)
|
||||
logger.quiet("Task ${thisTask.name} overrides compiler '${currentCompiler}' with '${cl}'.")
|
||||
|
||||
}
|
||||
doLast {
|
||||
//restore compiler
|
||||
|
@ -365,32 +345,27 @@ chipList.each { thisChip ->
|
|||
}
|
||||
|
||||
|
||||
thisTask.buildPath = ["$buildDir/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
thisTask.buildPath = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
thisTask.copyLibs = true
|
||||
thisTask.deleteJniFiles(false)
|
||||
outputName = "jnind4j${thisChip}"
|
||||
thisTask.outputDirectory = file("$buildDir/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
thisTask.outputDirectory = file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
thisTask.classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"]
|
||||
|
||||
thisTask.configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}")
|
||||
|
||||
//Need to set the classpath, so that external jars from the dependency list are resolved by the ClassLoader as well
|
||||
thisTask.classPath = [:]
|
||||
thisTask.classPath = ["${buildDir}/classes/java/${thisChip}Support"]
|
||||
thisTask.classPath += sourceSets.findByName("${thisChip}Support").runtimeClasspath
|
||||
//sourceSets.findByName("${thisChip}Support").runtimeClasspath.each{ s ->
|
||||
// thisTask.classPath += s
|
||||
//}
|
||||
thisTask.classPath = sourceSets.named("${thisChip}Generated").get().compileClasspath.collect()
|
||||
thisTask.classPath += "${buildDir}/classes/java/main/"
|
||||
}
|
||||
|
||||
// Create Jar with classifier
|
||||
tasks.getByName("${thisChip}SupportJar") { Jar thisTask ->
|
||||
tasks.getByName("${thisChip}Jar") { Jar thisTask ->
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCommand"
|
||||
|
||||
//it.from sourceSets.getByName("${thisChip}Support").getOutput()
|
||||
def spec = copySpec {
|
||||
from(tasks.getByName("javacpp${thisChip.capitalize()}SupportBuildCompiler")) {
|
||||
|
||||
from(tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").get()) {
|
||||
exclude { f ->
|
||||
def exclude = f.file.isDirectory()
|
||||
if(exclude) {
|
||||
|
@ -402,8 +377,8 @@ chipList.each { thisChip ->
|
|||
}
|
||||
into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands
|
||||
}
|
||||
from(sourceSets.getByName("${thisChip}Support").getOutput()) {
|
||||
|
||||
from(sourceSets.named(thisChip).get().getOutput()) {
|
||||
into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands
|
||||
}
|
||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
@ -415,34 +390,36 @@ chipList.each { thisChip ->
|
|||
|
||||
//Before we can compile the whole java part, we
|
||||
//need to generate the Nd4jXXX.java files first
|
||||
chipList.each { thisChip ->
|
||||
tasks.findByName("compile${thisChip.capitalize()}SupportJava").each { t ->
|
||||
t.dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
|
||||
tasks.named("compileJava").configure {enabled false}
|
||||
|
||||
chipList.each { String thisChip ->
|
||||
tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure {
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
|
||||
}
|
||||
|
||||
tasks.named("javacpp${thisChip.capitalize()}SupportBuildParser").configure {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// options.setCompilerArgs(Arrays.asList("-Xlint:unchecked"))
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc) {
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
|
||||
/*
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Class-Path': configurations.runtimeClasspath.collect { it.getName() }.join(' '),
|
||||
'Implementation-Title': 'Brutex AI - Native Components',
|
||||
'Implementation-Vendor': 'Brutex Network',
|
||||
'Implementation-Version': archiveVersion,
|
||||
'Specification-Title': 'Brutex AI - Native Components',
|
||||
'Specification-Vendor': 'Brutex Network',
|
||||
'Specification-Version': archiveVersion
|
||||
}
|
||||
//archiveClassifier = "${javacppPlatform}${javacppPlatformExtension}-${chip}"
|
||||
}
|
||||
*/
|
||||
javadoc {
|
||||
dependsOn "javacppPomProperties"
|
||||
failOnError = false
|
||||
|
@ -452,10 +429,6 @@ javadoc {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
tasks.getByName("generatePomFileForMavenJavaPublication") {
|
||||
enabled = true
|
||||
}
|
||||
|
@ -465,32 +438,14 @@ javadoc {
|
|||
|
||||
artifacts {
|
||||
//implementation(jar)
|
||||
chipList.each { thisChip ->
|
||||
implementation(tasks.getByName("${thisChip}SupportJar"))
|
||||
}
|
||||
|
||||
chipList.each { String thisChip ->
|
||||
implementation tasks.getByName("${thisChip}Jar")
|
||||
}
|
||||
|
||||
/*
|
||||
artifacts {
|
||||
archives jar
|
||||
chipList.each { thisChip ->
|
||||
archives tasks.getByName("${thisChip}SupportJar")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact jar
|
||||
chipList.each { thisChip ->
|
||||
artifact tasks.getByName("${thisChip}SupportJar")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
|
||||
if( osdetector.os.startsWith("windows")) {
|
||||
|
@ -516,48 +471,6 @@ if( osdetector.os.startsWith("windows")) {
|
|||
}
|
||||
*/
|
||||
|
||||
task printDeps {
|
||||
doLast {
|
||||
configurations.apiElements.dependencies.each { dep ->
|
||||
println "${dep.group} - ${dep.name} - ${dep.version}"
|
||||
dep.artifacts.each { art ->
|
||||
println " ${art.extension} - ${art.classifier}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
def pomClosure = {
|
||||
name = 'Brutex AI - Native Components'
|
||||
delegate.description = 'Underlying native components for the Brutex AI deeplearning framework for Java'
|
||||
url = 'https://ai.brutex.net'
|
||||
licenses {
|
||||
license {
|
||||
name = 'Apache License, Version 2.0'
|
||||
url = 'http://www.apache.org/licenses/LICENSE-2.0'
|
||||
distribution = 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = 'irnbrux'
|
||||
name = 'Brian Rosenberger'
|
||||
email = 'bru@brutex.de'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = 'https://brutex.net/svn/'
|
||||
connection = 'scm:svn:https://brutex.net/svn/bruai4j/'
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//tasks.getByName("publishMavenJavaPublicationToOSSRHRepository") { MavenRemotePublisher pub ->
|
||||
// logger.quiet(pub.dump());
|
||||
//}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
if (!version.endsWith('SNAPSHOT')) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# ******************************************************************************/
|
||||
#
|
||||
|
||||
#env
|
||||
env
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
@ -205,16 +205,16 @@ if(SD_CUDA)
|
|||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-fPIC")
|
||||
endif()
|
||||
|
||||
# if(WIN32)
|
||||
# message("In windows, setting cublas library and cusolver library")
|
||||
# if(NOT DEFINED CUDA_cublas_LIBRARY)
|
||||
# set(CUDA_cublas_LIBRARY ${CUDA_HOME}/lib/x64/cublas.lib)
|
||||
# endif()
|
||||
#
|
||||
# if(NOT DEFINED CUDA_cusolver_LIBRARY)
|
||||
# set(CUDA_cusolver_LIBRARY ${CUDA_HOME}/lib/x64/cusolver.lib)
|
||||
# endif()
|
||||
# endif()
|
||||
if(WIN32)
|
||||
message("In windows, setting cublas library and cusolver library")
|
||||
if(NOT DEFINED CUDA_cublas_LIBRARY)
|
||||
set(CUDA_cublas_LIBRARY ${CUDA_HOME}/lib/x64/cublas.lib)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CUDA_cusolver_LIBRARY)
|
||||
set(CUDA_cusolver_LIBRARY ${CUDA_HOME}/lib/x64/cusolver.lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
#string( TOLOWER "${COMPUTE}" COMPUTE_CMP )
|
||||
|
@ -242,6 +242,7 @@ if(SD_CUDA)
|
|||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda ")
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr ")
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -DCUDA_VERSION_MAJOR=12 -w --cudart=static -Xfatbin -compress-all")
|
||||
set(CUDAHOSTCXX "${CMAKE_CXX_COMPILER}")
|
||||
if(WIN32)
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=/EHsc")
|
||||
endif()
|
||||
|
@ -255,6 +256,7 @@ if(SD_CUDA)
|
|||
message("CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}")
|
||||
message("CUDA_PROPAGATE_HOST_FLAGS = ${CUDA_PROPAGATE_HOST_FLAGS}")
|
||||
message("CUDA_ARCH_FLAGS = ${CUDA_ARCH_FLAGS}")
|
||||
message("CUDAHOSTCXX = ${CUDAHOSTCXX}")
|
||||
|
||||
file(GLOB_RECURSE PERF_SOURCES false performance/*.cpp performance/*.h)
|
||||
file(GLOB_RECURSE EXCEPTIONS_SOURCES false exceptions/*.cpp exceptions/*.h)
|
||||
|
@ -301,11 +303,13 @@ if(SD_CUDA)
|
|||
|
||||
# build shared library by default or when it's explicitly requested
|
||||
if(NOT SD_STATIC_LIB OR SD_SHARED_LIB)
|
||||
message("Will build a shared library '${SD_LIBRARY_NAME}'.")
|
||||
add_library(${SD_LIBRARY_NAME} SHARED $<TARGET_OBJECTS:samediff_obj>)
|
||||
endif()
|
||||
|
||||
if (SD_STATIC_LIB AND SD_SHARED_LIB)
|
||||
# if both static and shared library are going to be built - static library will have special suffix
|
||||
message("Will build a static library '${SD_LIBRARY_NAME}static'.")
|
||||
add_library(${SD_LIBRARY_NAME}static STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME}static DESTINATION .)
|
||||
|
@ -327,7 +331,8 @@ if(SD_CUDA)
|
|||
endif()
|
||||
|
||||
#target_link_libraries(${SD_LIBRARY_NAME} ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN})
|
||||
target_link_libraries(${SD_LIBRARY_NAME} CUDA::cudart CUDA::cublas CUDA::cusolver ${CUDNN} ${MKLDNN})
|
||||
target_link_libraries(${SD_LIBRARY_NAME} CUDA::cudart CUDA::cublas CUDA::cusolver CUDA::cublasLt ${CUDNN} ${MKLDNN})
|
||||
#target_link_libraries(${SD_LIBRARY_NAME} ${CUDNN} ${MKLDNN})
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/cuda/${SD_EXTENSION})
|
||||
install(TARGETS ${SD_LIBRARY_NAME} DESTINATION .)
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* ******************************************************************************
|
||||
* *
|
||||
* * This program and the accompanying materials are made available under the
|
||||
* * terms of the Apache License, Version 2.0 which is available at
|
||||
* * https://www.apache.org/licenses/LICENSE-2.0.
|
||||
* *
|
||||
* * See the NOTICE file distributed with this work for additional
|
||||
* * information regarding copyright ownership.
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* * License for the specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
* *
|
||||
* * SPDX-License-Identifier: Apache-2.0
|
||||
* *****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
package org.nd4j.nativeblas;
|
||||
|
||||
public class Dummy {
|
||||
}
|
|
@ -37,7 +37,10 @@ import java.util.List;
|
|||
* @author saudet
|
||||
*/
|
||||
@Properties(target = "org.nd4j.nativeblas.Nd4jCuda", helper = "org.nd4j.nativeblas.cuda.Nd4jCudaHelper",
|
||||
value = {@Platform(define = "LIBND4J_ALL_OPS", include = {
|
||||
value = {
|
||||
@Platform(
|
||||
define = "LIBND4J_ALL_OPS",
|
||||
include = {
|
||||
"array/DataType.h",
|
||||
"array/DataBuffer.h",
|
||||
"array/PointerDeallocator.h",
|
||||
|
@ -125,12 +128,15 @@ import java.util.List;
|
|||
"cnpy/cnpy.h"
|
||||
},
|
||||
compiler = {"cpp11", "nowarnings"},
|
||||
library = "jnind4jcuda", link = "nd4jcuda", preload = "nd4jcuda"),
|
||||
library = "jnind4jcuda",
|
||||
link = "nd4jcuda"),
|
||||
|
||||
@Platform(value = "linux", preload = "gomp@.1", preloadpath = {"/lib64/", "/lib/", "/usr/lib64/", "/usr/lib/", "/usr/local/cuda/lib64"}),
|
||||
@Platform(value = "linux-armhf", preloadpath = {"/usr/arm-linux-gnueabihf/lib/", "/usr/lib/arm-linux-gnueabihf/"}),
|
||||
@Platform(value = "linux-arm64", preloadpath = {"/usr/aarch64-linux-gnu/lib/", "/usr/lib/aarch64-linux-gnu/"}),
|
||||
@Platform(value = "linux-ppc64", preloadpath = {"/usr/powerpc64-linux-gnu/lib/", "/usr/powerpc64le-linux-gnu/lib/", "/usr/lib/powerpc64-linux-gnu/", "/usr/lib/powerpc64le-linux-gnu/"}),
|
||||
@Platform(value = "windows", preload = {"libwinpthread-1", "libgcc_s_seh-1", "libgomp-1", "libstdc++-6", "nd4jcuda"}) })
|
||||
@Platform(value = "linux-ppc64", preloadpath = {"/usr/powerpc64-linux-gnu/lib/", "/usr/powerpc64le-linux-gnu/lib/", "/usr/lib/powerpc64-linux-gnu/", "/usr/lib/powerpc64le-linux-gnu/"})
|
||||
//@Platform(value = "windows", preload = {"libwinpthread-1", "libgcc_s_seh-1", "libgomp-1", "libstdc++-6", "nd4jcuda"})
|
||||
})
|
||||
public class Nd4jCudaPresets implements LoadEnabled, InfoMapper {
|
||||
|
||||
@Override public void init(ClassProperties properties) {
|
||||
|
@ -143,9 +149,14 @@ public class Nd4jCudaPresets implements LoadEnabled, InfoMapper {
|
|||
return;
|
||||
}
|
||||
int i = 0;
|
||||
/*
|
||||
String[] libs = {"cudart", "cublasLt", "cublas", "curand", "cusolver", "cusparse", "cudnn",
|
||||
"cudnn_ops_infer", "cudnn_ops_train", "cudnn_adv_infer",
|
||||
"cudnn_adv_train", "cudnn_cnn_infer", "cudnn_cnn_train"};
|
||||
|
||||
*/
|
||||
// test no preload
|
||||
String[] libs = {};
|
||||
for (String lib : libs) {
|
||||
if (platform.startsWith("linux")) {
|
||||
lib += lib.startsWith("cudnn") ? "@.8" : lib.equals("curand") ? "@.10" : lib.equals("cufft") ? "@.11" : "@.12";
|
||||
|
|
|
@ -31,4 +31,8 @@ ext {
|
|||
withCpu = { ->
|
||||
return chip.contains("cpu")
|
||||
}
|
||||
|
||||
if ( ! rootProject.hasProperty("skip-native")) {
|
||||
logger.info("Project variable 'skip-native' is not set. Will default to 'false'.")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ ext {
|
|||
|
||||
chipList.each { thisChip ->
|
||||
configurations.register("${thisChip}TestImplementation") {
|
||||
it.extendsFrom configurations.testImplementation, configurations.implementation
|
||||
it.extendsFrom configurations.testImplementation //, configurations.implementation
|
||||
|
||||
}
|
||||
configurations.register("${thisChip}TestRuntime") {
|
||||
|
@ -79,6 +79,7 @@ ext {
|
|||
|
||||
|
||||
dependencies {
|
||||
//testRuntime projects.cavisNative.cavisNativeLib
|
||||
if (withCuda()) {
|
||||
cudaTestRuntime platform(projects.cavisCommonPlatform)
|
||||
cudaTestRuntime projects.cavisNative.cavisNativeJcublas
|
||||
|
@ -87,17 +88,11 @@ ext {
|
|||
cudaTestRuntime group: "org.bytedeco", name: "openblas", classifier: buildTarget
|
||||
cudaTestRuntime group: "org.bytedeco", name: "cuda"
|
||||
cudaTestRuntime group: "org.bytedeco", name: "cuda", classifier: buildTarget
|
||||
//cudaTestRuntime group: "org.bytedeco", name: "cuda", classifier: "${buildTarget}-redist"
|
||||
cudaTestRuntime (project( path: ":cavis-native:cavis-native-lib", configuration: "cudaSupportRuntimeElements"))
|
||||
/*
|
||||
cudaTestRuntime(project(":cavis-native:cavis-native-lib")) {
|
||||
|
||||
capabilities {
|
||||
it.requireCapabilities "net.brutex.cavis.native:cavis-native-lib-cuda-support:1.0.0-SNAPSHOT"
|
||||
it.requireCapabilities "net.brutex.cavis.cavis-native:cavis-native-lib-cuda-support:${project.version}"
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
if (withCpu()) {
|
||||
|
@ -107,16 +102,11 @@ ext {
|
|||
cpuTestRuntime group: "org.bytedeco", name: "openblas", classifier: buildTarget
|
||||
cpuTestRuntime group: "org.bytedeco", name: "opencv"
|
||||
cpuTestRuntime group: "org.bytedeco", name: "opencv", classifier: buildTarget
|
||||
cpuTestRuntime project( path: ":cavis-native:cavis-native-lib", configuration: "cpuSupportRuntimeElements")
|
||||
/*
|
||||
cpuTestRuntime(project(":cavis-native:cavis-native-lib")) {
|
||||
|
||||
capabilities {
|
||||
it.requireCapabilities "net.brutex.cavis.native:cavis-native-lib-cpu-support:1.0.0-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
it.requireCapabilities "net.brutex.cavis.cavis-native:cavis-native-lib-cpu-support:${project.version}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -85,6 +85,8 @@ include ':cavis-native'
|
|||
include ':cavis-native:cavis-native-blas'
|
||||
if(withCuda()) { include ':cavis-native:cavis-native-jcublas'}
|
||||
if(withCpu()) { include ':cavis-native:cavis-native-cpu' }
|
||||
if(withCuda()) { include 'cavis-native:cavis-native-cuda-presets' }
|
||||
if(withCpu()) { include 'cavis-native:cavis-native-cpu-presets' }
|
||||
include ':cavis-native:cavis-native-lib'
|
||||
include ':cavis-native:cavis-native-common'
|
||||
include ':cavis-dnn'
|
||||
|
@ -155,4 +157,3 @@ include ':brutex-extended-tests'
|
|||
include ':cavis-full'
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,12 +26,17 @@
|
|||
* proven in the past to be unreliable when multiple versions of Visual Studio
|
||||
* and SDKs are installed.
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
if (!hasProperty("VISUAL_STUDIO_INSTALL_DIR") && osdetector.os.equals("windows")) {
|
||||
if (project.hasProperty("skip-native") && !project.getProperty("skip-native").equals("true")) {
|
||||
configureVisualStudio()
|
||||
}
|
||||
}
|
||||
*/
|
||||
if(osdetector.os.equals("windows")) {
|
||||
logger.quiet("Detected windows operating system. Running configureVisualStudio().")
|
||||
configureVisualStudio()
|
||||
}
|
||||
|
||||
def configureVisualStudio() {
|
||||
|
||||
|
@ -46,35 +51,35 @@ def configureVisualStudio() {
|
|||
rootProject.ext.VISUAL_STUDIO_VCVARS_CMD = ""
|
||||
|
||||
// Use vswhere.exe to search for latest Visual Studio installation
|
||||
println "Searching for latest Visual Studio and required components..."
|
||||
logger.quiet("Searching for latest Visual Studio and required components...")
|
||||
def vswherePath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe"
|
||||
if (!file(vswherePath).exists()) {
|
||||
println "Visual Studio not found!"
|
||||
logger.error("Visual Studio not found!")
|
||||
return
|
||||
}
|
||||
def vswhereOutput = "${vswherePath} -latest -format json".execute().text.trim()
|
||||
def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput)
|
||||
if (vswhereJson.isEmpty()) {
|
||||
println "Visual Studio not found!"
|
||||
logger.error("Visual Studio not found!")
|
||||
return
|
||||
}
|
||||
def vsInstallDir = vswhereJson[0].installationPath
|
||||
println " -> Installation Directory: ${vsInstallDir}"
|
||||
logger.quiet(" -> Installation Directory: ${vsInstallDir}")
|
||||
|
||||
// Use vcvarsall.bat to determine the latest Visual Studio's default SDK and tool versions
|
||||
def vcvarsPath = "${vsInstallDir}\\VC\\Auxiliary\\Build\\vcvarsall.bat"
|
||||
def vcvarsCmd = "\"${vcvarsPath}\" x64"
|
||||
def vcvarsEnvCmd = "cmd /v:ON /c ${vcvarsCmd} > nul && cmd /c echo"
|
||||
def toolsVersion = "${vcvarsEnvCmd} !VCToolsVersion!".execute().text.trim()
|
||||
println " -> VCTools Version (default): ${toolsVersion}"
|
||||
logger.quiet(" -> VCTools Version (default): ${toolsVersion}")
|
||||
def sdkDir = "${vcvarsEnvCmd} !WindowsSdkDir!".execute().text.trim()
|
||||
println " -> SDK Directory (default): ${sdkDir}"
|
||||
logger.quiet(" -> SDK Directory (default): ${sdkDir}")
|
||||
def sdkVersion = "${vcvarsEnvCmd} !WindowsSDKVersion!".execute().text.trim().replace('\\', '')
|
||||
println " -> SDK Version (default): ${sdkVersion}"
|
||||
logger.quiet(" -> SDK Version (default): ${sdkVersion}")
|
||||
|
||||
// Check Gradle properties for override values
|
||||
def windowsTargetPlatformVersion = findProperty("WindowsTargetPlatformVersion")
|
||||
println " -> SDK Version (override): " + (windowsTargetPlatformVersion ?: "N/A")
|
||||
logger.quiet(" -> SDK Version (override): " + (windowsTargetPlatformVersion ?: "N/A"))
|
||||
|
||||
// Save Visual Studio information so other projects can access it
|
||||
rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = vsInstallDir
|
||||
|
|
Loading…
Reference in New Issue