From 2320cb600fa3e592464632d6716a45458fce1ada Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 6 May 2020 13:08:43 -0700 Subject: [PATCH 01/88] Detect os and arch and move the artifacts to a new folder. --- cmake/onnxruntime_java.cmake | 55 ++++++++++++++----- .../main/java/ai/onnxruntime/OnnxRuntime.java | 35 +++++++++++- 2 files changed, 75 insertions(+), 15 deletions(-) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 6ef9b5baff1cf..4906f02061dc9 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -96,37 +96,64 @@ target_link_libraries(onnxruntime4j_jni PUBLIC onnxruntime) set(JAVA_PACKAGE_OUTPUT_DIR ${JAVA_OUTPUT_DIR}/build) file(MAKE_DIRECTORY ${JAVA_PACKAGE_OUTPUT_DIR}) if (CMAKE_SYSTEM_NAME STREQUAL "Android") - set(ANDROID_PACKAGE_OUTPUT_DIR ${JAVA_PACKAGE_OUTPUT_DIR}/android) - file(MAKE_DIRECTORY ${ANDROID_PACKAGE_OUTPUT_DIR}) + set(ANDROID_PACKAGE_OUTPUT_DIR ${JAVA_PACKAGE_OUTPUT_DIR}/android) + file(MAKE_DIRECTORY ${ANDROID_PACKAGE_OUTPUT_DIR}) endif() + +# Set platform and ach for packaging +if(CMAKE_SIZEOF_VOID_P EQUAL "8") + set(JNI_ARCH x64) +else() + set(JNI_ARCH x86) +endif() + +if (WIN32) + set(JAVA_PLAT "win") +elseif (APPLE) + set(JAVA_PLAT "osx") +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(JAVA_PLAT "linux") +else() + # We don't do distribution for Android + # Set for completeness + set(JAVA_PLAT "android") + endif() + +# Similar to Nuget schema +set(JAVA_OS_ARCH ${JAVA_PLAT}-${JNI_ARCH}) + # expose native libraries to the gradle build process -set(JAVA_PACKAGE_DIR ai/onnxruntime/native/) +set(JAVA_PACKAGE_DIR ai/onnxruntime/native/${JAVA_OS_ARCH}) set(JAVA_NATIVE_LIB_DIR ${JAVA_OUTPUT_DIR}/native-lib) set(JAVA_NATIVE_JNI_DIR ${JAVA_OUTPUT_DIR}/native-jni) set(JAVA_PACKAGE_LIB_DIR ${JAVA_NATIVE_LIB_DIR}/${JAVA_PACKAGE_DIR}) set(JAVA_PACKAGE_JNI_DIR ${JAVA_NATIVE_JNI_DIR}/${JAVA_PACKAGE_DIR}) file(MAKE_DIRECTORY ${JAVA_PACKAGE_LIB_DIR}) file(MAKE_DIRECTORY ${JAVA_PACKAGE_JNI_DIR}) + if (CMAKE_SYSTEM_NAME STREQUAL "Android") - set(ANDROID_PACKAGE_JNILIBS_DIR ${JAVA_OUTPUT_DIR}/android) - set(ANDROID_PACKAGE_ABI_DIR ${ANDROID_PACKAGE_JNILIBS_DIR}/${ANDROID_ABI}) - file(MAKE_DIRECTORY ${ANDROID_PACKAGE_JNILIBS_DIR}) - file(MAKE_DIRECTORY ${ANDROID_PACKAGE_ABI_DIR}) + set(ANDROID_PACKAGE_JNILIBS_DIR ${JAVA_OUTPUT_DIR}/android) + set(ANDROID_PACKAGE_ABI_DIR ${ANDROID_PACKAGE_JNILIBS_DIR}/${ANDROID_ABI}) + file(MAKE_DIRECTORY ${ANDROID_PACKAGE_JNILIBS_DIR}) + file(MAKE_DIRECTORY ${ANDROID_PACKAGE_ABI_DIR}) endif() + # On Windows TARGET_LINKER_FILE_NAME is the .lib, TARGET_FILE_NAME is the .dll if (WIN32) - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_LIB_DIR}/$) - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_JNI_DIR}/$) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_LIB_DIR}/$) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_JNI_DIR}/$) else() - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_LIB_DIR}/$) - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_JNI_DIR}/$) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_LIB_DIR}/$) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_PACKAGE_JNI_DIR}/$) endif() + if (CMAKE_SYSTEM_NAME STREQUAL "Android") - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${ANDROID_PACKAGE_ABI_DIR}/$) - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${ANDROID_PACKAGE_ABI_DIR}/$) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${ANDROID_PACKAGE_ABI_DIR}/$) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${ANDROID_PACKAGE_ABI_DIR}/$) endif() + # run the build process (this copies the results back into CMAKE_CURRENT_BINARY_DIR) add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} cmakeBuild -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${JAVA_ROOT}) if (CMAKE_SYSTEM_NAME STREQUAL "Android") - add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} -b build-android.gradle -c settings-android.gradle build -DjniLibsDir=${ANDROID_PACKAGE_JNILIBS_DIR} -DbuildDir=${ANDROID_PACKAGE_OUTPUT_DIR} WORKING_DIRECTORY ${JAVA_ROOT}) + add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} -b build-android.gradle -c settings-android.gradle build -DjniLibsDir=${ANDROID_PACKAGE_JNILIBS_DIR} -DbuildDir=${ANDROID_PACKAGE_OUTPUT_DIR} WORKING_DIRECTORY ${JAVA_ROOT}) endif() diff --git a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java index 12a8c42881826..44c5cc1a6342a 100644 --- a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java +++ b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java @@ -10,6 +10,7 @@ import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; @@ -32,6 +33,8 @@ final class OnnxRuntime { /** The short name of the ONNX runtime JNI shared library */ static final String ONNXRUNTIME_JNI_LIBRARY_NAME = "onnxruntime4j_jni"; + private static String OS_ARCH_STR; + private static boolean loaded = false; /** The API handle. */ @@ -39,6 +42,35 @@ final class OnnxRuntime { private OnnxRuntime() {} + /** + * Computes and initializes OS_ARCH_STR (such as linux-x64) + * + * @throws IOException If it can't write to disk to copy out the library from the jar file. + */ + private static void initOsArch() throws IOException { + String detectedOS = null; + String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); + if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { + detectedOS = "osx"; + } else if (OS.indexOf("win") >= 0) { + detectedOS = "win"; + } else if (OS.indexOf("nux") >= 0) { + detectedOS = "linux"; + } else { + detectedOS = "android"; + } + String detectedArch = null; + String arch = System.getProperty("os.arch", "generic").toLowerCase(Locale.ENGLISH); + if (arch.indexOf("x86") == 0) { + detectedArch = "x86"; // x86_32 + } else if (arch.indexOf("amd64") == 0) { + detectedArch = "x64"; + } else { + throw new IOException("Unsupported arch:" + arch); + } + OS_ARCH_STR = detectedOS + '-' + detectedArch; + } + /** * Loads the native C library. * @@ -48,6 +80,7 @@ static synchronized void init() throws IOException { if (loaded) { return; } + initOsArch(); Path tempDirectory = isAndroid() ? null : Files.createTempDirectory("onnxruntime-java"); try { load(tempDirectory, ONNXRUNTIME_LIBRARY_NAME); @@ -136,7 +169,7 @@ private static void load(Path tempDirectory, String library) throws IOException // generate a platform specific library name // replace Mac's jnilib extension to dylib String libraryFileName = System.mapLibraryName(library).replace("jnilib", "dylib"); - String resourcePath = "/ai/onnxruntime/native/" + libraryFileName; + String resourcePath = "/ai/onnxruntime/native/" + OS_ARCH_STR + '/' + libraryFileName; File tempFile = tempDirectory.resolve(libraryFileName).toFile(); try (InputStream is = OnnxRuntime.class.getResourceAsStream(resourcePath)) { if (is == null) { From 39430bb03bf1b98931b2a383c03fff6bf039c097 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 6 May 2020 13:22:31 -0700 Subject: [PATCH 02/88] Adjust arch detection. --- java/src/main/java/ai/onnxruntime/OnnxRuntime.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java index 44c5cc1a6342a..c5edd8a2cd0d4 100644 --- a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java +++ b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java @@ -61,10 +61,10 @@ private static void initOsArch() throws IOException { } String detectedArch = null; String arch = System.getProperty("os.arch", "generic").toLowerCase(Locale.ENGLISH); - if (arch.indexOf("x86") == 0) { - detectedArch = "x86"; // x86_32 - } else if (arch.indexOf("amd64") == 0) { + if (arch.indexOf("amd64") == 0) { detectedArch = "x64"; + } else if (arch.indexOf("x86") == 0) { + detectedArch = "x86"; } else { throw new IOException("Unsupported arch:" + arch); } From 82f98777c30f6f85f42dbac984e4b8cb0d950642 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 6 May 2020 14:06:30 -0700 Subject: [PATCH 03/88] Remove unnecesary jars so we cam focus on those we publish. --- cmake/onnxruntime_java.cmake | 6 +++++- java/build.gradle | 21 --------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 4906f02061dc9..5d49526047941 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -153,7 +153,11 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android") endif() # run the build process (this copies the results back into CMAKE_CURRENT_BINARY_DIR) -add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} cmakeBuild -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${JAVA_ROOT}) +set(GRADLE_ARGS cmakeBuild -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR}) +if(WIN32) + set(GRADLE_ARGS ${GRADLE_ARGS} -Dorg.gradle.daemon=false) +endif() +add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} ${GRADLE_ARGS} WORKING_DIRECTORY ${JAVA_ROOT}) if (CMAKE_SYSTEM_NAME STREQUAL "Android") add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} -b build-android.gradle -c settings-android.gradle build -DjniLibsDir=${ANDROID_PACKAGE_JNILIBS_DIR} -DbuildDir=${ANDROID_PACKAGE_OUTPUT_DIR} WORKING_DIRECTORY ${JAVA_ROOT}) endif() diff --git a/java/build.gradle b/java/build.gradle index 1119a2c7d7fda..01503d33b764a 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -19,13 +19,6 @@ java { project.group = "ai.onnxruntime" version = rootProject.file('../VERSION_NUMBER').text.trim() -jar { - into("META-INF/maven/$project.group/$project.name") { - from { generatePomFileForMavenPublication } - rename ".*", "pom.xml" - } -} - // Add explicit sources jar with pom file. task sourcesJar(type: Jar, dependsOn: classes) { classifier = "sources" @@ -94,22 +87,11 @@ sourceSets.test { if (cmakeBuildDir != null) { // generate tasks to be called from cmake - task jniJar(type: Jar) { - classifier = 'jni' - from cmakeNativeJniDir - } - - task libJar(type: Jar) { - classifier = 'lib' - from cmakeNativeLibDir - } - task allJar(type: Jar) { into("META-INF/maven/$project.group/$project.name") { from { generatePomFileForMavenPublication } rename ".*", "pom.xml" } - classifier = 'all' from sourceSets.main.output from cmakeNativeJniDir from cmakeNativeLibDir @@ -121,9 +103,6 @@ if (cmakeBuildDir != null) { include 'docs/**' into cmakeBuildOutputDir } - cmakeBuild.dependsOn jar - cmakeBuild.dependsOn jniJar - cmakeBuild.dependsOn libJar cmakeBuild.dependsOn allJar cmakeBuild.dependsOn sourcesJar cmakeBuild.dependsOn javadocJar From 573ff018c46922359aab1d1ba3da9829af6db6d3 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 6 May 2020 17:16:28 -0700 Subject: [PATCH 04/88] Attempt uploadArchive method but it produces no signature error. --- java/build.gradle | 62 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/java/build.gradle b/java/build.gradle index 01503d33b764a..6800e90a666f2 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -1,7 +1,8 @@ plugins { - id 'java' - id 'jacoco' + id 'java-library' id 'maven-publish' + id 'signing' + id 'jacoco' id 'com.diffplug.gradle.spotless' version '3.26.0' } @@ -11,21 +12,25 @@ allprojects { } } +project.group = "ai.onnxruntime" +version = rootProject.file('../VERSION_NUMBER').text.trim() + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } -project.group = "ai.onnxruntime" -version = rootProject.file('../VERSION_NUMBER').text.trim() + +jar { + into("META-INF/maven/$project.group/$project.name") { + } +} // Add explicit sources jar with pom file. task sourcesJar(type: Jar, dependsOn: classes) { classifier = "sources" from sourceSets.main.allSource into("META-INF/maven/$project.group/$project.name") { - from { generatePomFileForMavenPublication } - rename ".*", "pom.xml" } } @@ -34,13 +39,11 @@ task javadocJar(type: Jar, dependsOn: javadoc) { classifier = "javadoc" from javadoc.destinationDir into("META-INF/maven/$project.group/$project.name") { - from { generatePomFileForMavenPublication } - rename ".*", "pom.xml" } } wrapper { - gradleVersion = '6.1.1' + gradleVersion = '6.3' } spotless { @@ -89,8 +92,6 @@ if (cmakeBuildDir != null) { task allJar(type: Jar) { into("META-INF/maven/$project.group/$project.name") { - from { generatePomFileForMavenPublication } - rename ".*", "pom.xml" } from sourceSets.main.output from cmakeNativeJniDir @@ -142,17 +143,36 @@ jacocoTestReport { } } -publishing { - publications { - maven(MavenPublication) { - groupId = project.group - artifactId = project.name +artifacts { + archives jar, sourcesJar, javadocJar +} + +signing { + sign configurations.archives +} + +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } from components.java - pom { + pom.project { name = 'onnx-runtime' + packaging 'jar' description = 'ONNX Runtime is a performance-focused inference engine for ONNX (Open Neural Network Exchange) models.' url = 'https://microsoft.github.io/onnxruntime/' + groupId = project.group + artifactId = project.name + licenses { license { name = 'MIT License' @@ -168,7 +188,15 @@ publishing { developerConnection = 'scm:git:ssh://github.com/microsoft/onnxruntime.git' url = 'https://github.com/microsoft/onnxruntime' } + developers { + developer { + id 'onnxruntime' + name 'ONNX Runtime' + email 'onnxruntime@microsoft.com' + } + } } } } } + From 1be9c58720af61be75ab71ca36eb4a2bae89659a Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 7 May 2020 16:00:47 -0700 Subject: [PATCH 05/88] Add signing --- java/build.gradle | 63 ++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/java/build.gradle b/java/build.gradle index 6800e90a666f2..d37923f983974 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -21,6 +21,8 @@ java { } +// This jar tasks serves as a CMAKE signalling +// mechanism. The jar will be overwritten by allJar task jar { into("META-INF/maven/$project.group/$project.name") { } @@ -31,6 +33,8 @@ task sourcesJar(type: Jar, dependsOn: classes) { classifier = "sources" from sourceSets.main.allSource into("META-INF/maven/$project.group/$project.name") { + from { generatePomFileForMavenPublication } + rename ".*", "pom.xml" } } @@ -39,6 +43,8 @@ task javadocJar(type: Jar, dependsOn: javadoc) { classifier = "javadoc" from javadoc.destinationDir into("META-INF/maven/$project.group/$project.name") { + from { generatePomFileForMavenPublication } + rename ".*", "pom.xml" } } @@ -66,6 +72,9 @@ def cmakeNativeJniDir = "${cmakeJavaDir}/native-jni" def cmakeNativeTestDir = "${cmakeJavaDir}/native-test" def cmakeBuildOutputDir = "${cmakeJavaDir}/build" +def mavenUser = System.properties['mavenUser'] +def mavenPwd = System.properties['mavenPwd'] + compileJava { options.compilerArgs += ["-h", "${project.buildDir}/headers/"] } @@ -90,8 +99,11 @@ sourceSets.test { if (cmakeBuildDir != null) { // generate tasks to be called from cmake + // Overwrite jar location task allJar(type: Jar) { into("META-INF/maven/$project.group/$project.name") { + from { generatePomFileForMavenPublication } + rename ".*", "pom.xml" } from sourceSets.main.output from cmakeNativeJniDir @@ -143,36 +155,17 @@ jacocoTestReport { } } -artifacts { - archives jar, sourcesJar, javadocJar -} - -signing { - sign configurations.archives -} - -uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } +publishing { + publications { + maven(MavenPublication) { + groupId = project.group + artifactId = project.name from components.java - pom.project { + pom { name = 'onnx-runtime' - packaging 'jar' description = 'ONNX Runtime is a performance-focused inference engine for ONNX (Open Neural Network Exchange) models.' url = 'https://microsoft.github.io/onnxruntime/' - groupId = project.group - artifactId = project.name - licenses { license { name = 'MIT License' @@ -197,6 +190,26 @@ uploadArchives { } } } + maven { + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + credentials { + username mavenUser + password mavenUser + } + } } } +// Generates a task signMavenJavaPublication that will +// build all artifacts. +signing { + // Queries env vars: + // ORG_GRADLE_PROJECT_signingKeyId + // ORG_GRADLE_PROJECT_signingKey + // ORG_GRADLE_PROJECT_signingPassword but can be changed to properties + def signingKeyId = findProperty("signingKeyId") + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign publishing.publications.mavenJava +} From 70309317dccf25f2cac1d9e1240f5f2a1107c486 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 8 May 2020 10:42:46 -0700 Subject: [PATCH 06/88] Revert wrapper --- java/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/build.gradle b/java/build.gradle index d37923f983974..e3944f60432f6 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -49,7 +49,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) { } wrapper { - gradleVersion = '6.3' + gradleVersion = '6.1.1' } spotless { From b6875b1ad80789334869e428862b84050490d217 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 8 May 2020 11:34:34 -0700 Subject: [PATCH 07/88] Apply Adam's patch and review comments. --- java/build.gradle | 15 ++++++------ .../main/java/ai/onnxruntime/OnnxRuntime.java | 23 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/java/build.gradle b/java/build.gradle index e3944f60432f6..4da1f7bdaedb7 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -20,12 +20,9 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } - // This jar tasks serves as a CMAKE signalling // mechanism. The jar will be overwritten by allJar task jar { - into("META-INF/maven/$project.group/$project.name") { - } } // Add explicit sources jar with pom file. @@ -183,18 +180,20 @@ publishing { } developers { developer { - id 'onnxruntime' - name 'ONNX Runtime' - email 'onnxruntime@microsoft.com' + id = 'onnxruntime' + name = 'ONNX Runtime' + email = 'onnxruntime@microsoft.com' } } } } + } + repositories { maven { url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' credentials { username mavenUser - password mavenUser + password mavenPwd } } } @@ -211,5 +210,5 @@ signing { def signingKey = findProperty("signingKey") def signingPassword = findProperty("signingPassword") useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - sign publishing.publications.mavenJava + sign publishing.publications.maven } diff --git a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java index c5edd8a2cd0d4..88aaa17ab9902 100644 --- a/java/src/main/java/ai/onnxruntime/OnnxRuntime.java +++ b/java/src/main/java/ai/onnxruntime/OnnxRuntime.java @@ -33,7 +33,7 @@ final class OnnxRuntime { /** The short name of the ONNX runtime JNI shared library */ static final String ONNXRUNTIME_JNI_LIBRARY_NAME = "onnxruntime4j_jni"; - private static String OS_ARCH_STR; + private static final String OS_ARCH_STR = initOsArch(); private static boolean loaded = false; @@ -42,19 +42,15 @@ final class OnnxRuntime { private OnnxRuntime() {} - /** - * Computes and initializes OS_ARCH_STR (such as linux-x64) - * - * @throws IOException If it can't write to disk to copy out the library from the jar file. - */ - private static void initOsArch() throws IOException { + /* Computes and initializes OS_ARCH_STR (such as linux-x64) */ + private static String initOsArch() { String detectedOS = null; - String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); - if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { + String os = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); + if (os.contains("mac") || os.contains("darwin")) { detectedOS = "osx"; - } else if (OS.indexOf("win") >= 0) { + } else if (os.contains("win")) { detectedOS = "win"; - } else if (OS.indexOf("nux") >= 0) { + } else if (os.contains("nux")) { detectedOS = "linux"; } else { detectedOS = "android"; @@ -66,9 +62,9 @@ private static void initOsArch() throws IOException { } else if (arch.indexOf("x86") == 0) { detectedArch = "x86"; } else { - throw new IOException("Unsupported arch:" + arch); + throw new IllegalStateException("Unsupported arch:" + arch); } - OS_ARCH_STR = detectedOS + '-' + detectedArch; + return detectedOS + '-' + detectedArch; } /** @@ -80,7 +76,6 @@ static synchronized void init() throws IOException { if (loaded) { return; } - initOsArch(); Path tempDirectory = isAndroid() ? null : Files.createTempDirectory("onnxruntime-java"); try { load(tempDirectory, ONNXRUNTIME_LIBRARY_NAME); From f5eba048a508ae23ed82d8d287a0e49844d70751 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 8 May 2020 16:29:02 -0700 Subject: [PATCH 08/88] Make signature simlper. --- java/build.gradle | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/java/build.gradle b/java/build.gradle index 4da1f7bdaedb7..9dd6861e6f938 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -199,16 +199,14 @@ publishing { } } -// Generates a task signMavenJavaPublication that will +// Generates a task signMavenPublication that will // build all artifacts. signing { // Queries env vars: - // ORG_GRADLE_PROJECT_signingKeyId // ORG_GRADLE_PROJECT_signingKey // ORG_GRADLE_PROJECT_signingPassword but can be changed to properties - def signingKeyId = findProperty("signingKeyId") def signingKey = findProperty("signingKey") def signingPassword = findProperty("signingPassword") - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.maven } From 5920d100cd0e63d6b8df9e178588125c8f893653 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 11 May 2020 14:38:46 -0700 Subject: [PATCH 09/88] Fix indent. --- cmake/onnxruntime_java.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 5d49526047941..f2bf63e4d4d27 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -104,7 +104,7 @@ endif() if(CMAKE_SIZEOF_VOID_P EQUAL "8") set(JNI_ARCH x64) else() - set(JNI_ARCH x86) + set(JNI_ARCH x86) endif() if (WIN32) From 9a3f7afa7e2dfb7d3b9057cd411b253ad6e2ca48 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 12 May 2020 14:10:39 -0700 Subject: [PATCH 10/88] Halt on 32-bit arch. --- cmake/onnxruntime_java.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index f2bf63e4d4d27..0c4338fc93413 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -104,7 +104,7 @@ endif() if(CMAKE_SIZEOF_VOID_P EQUAL "8") set(JNI_ARCH x64) else() - set(JNI_ARCH x86) + message(FATAL_ERROR "Java is currently not supported for x86 architecture") endif() if (WIN32) From 7e2503c524c7216cfc1d7a3aa1a91a5f6e56eafa Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 12 May 2020 17:51:58 -0700 Subject: [PATCH 11/88] Java Pipeline start. --- ...ifacts-package-and-publish-steps-posix.yml | 28 +++++++++ ...acts-package-and-publish-steps-windows.yml | 40 +++++++++++++ .../github/linux/java_copy_strip_binary.sh | 59 +++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml create mode 100644 tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml create mode 100644 tools/ci_build/github/linux/java_copy_strip_binary.sh diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml new file mode 100644 index 0000000000000..225e630e15d2e --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -0,0 +1,28 @@ +# sets up common build tools for the windows build machines before build + +parameters: + buildConfig: 'RelWithDebInfo' + artifactName: 'onnxruntime-linux-x64' + libraryName: 'libonnxruntime.so' + commitId: '' +steps: + - task: ShellScript@2 + displayName: 'Copy build artifacts for zipping' + inputs: + scriptPath: 'tools/ci_build/github/linux/copy_strip_binary.sh' + args: '-r $(Build.BinariesDirectory) -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -c ${{parameters.buildConfig}} -s $(Build.SourcesDirectory) -t ${{parameters.commitId}}' + workingDirectory: '$(Build.BinariesDirectory)/${{parameters.buildConfig}}' + + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)/${{parameters.artifactName}}' + includeRootFolder: true + archiveType: 'tar' # Options: zip, 7z, tar, wim + tarCompression: 'gz' + archiveFile: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.tgz' + replaceExistingArchive: true + + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.tgz' + artifactName: 'drop-${{parameters.artifactName}}' diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml new file mode 100644 index 0000000000000..936227bd954d6 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -0,0 +1,40 @@ +# sets up common build tools for the windows build machines before build + +parameters: + buildConfig: 'RelWithDebInfo' + artifactName: 'onnxruntime-win-x64' + comitId: '' +steps: + - task: CmdLine@2 + displayName: 'Copy build artifacts for zipping' + inputs: + script: | + mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + echo "Directories created" + + # Copy all jars + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + # We will need to make this a part of a jar + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime4j_jni.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + + # copy the licence, privacy and TPN + copy $(Build.SourcesDirectory)\LICENSE $(Build.BinariesDirectory)\${{parameters.artifactName}}\LICENSE + copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\Privacy.md + copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\${{parameters.artifactName}}\ThirdPartyNotices.txt + @echo ${{parameters.commitId}} > $(Build.BinariesDirectory)\${{parameters.artifactName}}\GIT_COMMIT_ID + + workingDirectory: '$(Build.BinariesDirectory)\${{parameters.buildConfig}}' + + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)\${{parameters.artifactName}}' + includeRootFolder: true + archiveType: 'zip' # Options: zip, 7z, tar, wim + archiveFile: '$(Build.ArtifactStagingDirectory)\${{parameters.artifactName}}.zip' + replaceExistingArchive: true + + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)\${{parameters.artifactName}}.zip' + artifactName: 'drop-${{parameters.artifactName}}' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh new file mode 100644 index 0000000000000..043a8bb38dbe7 --- /dev/null +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -e -o -x + +while getopts r:a:l:n:c:h: parameter_Option +do case "${parameter_Option}" +in +r) BINARY_DIR=${OPTARG};; +a) ARTIFACT_NAME=${OPTARG};; +l) LIB_NAME=${OPTARG};; +n) NATIVE_LIB_NAME=${OPTARG};; +c) BUILD_CONFIG=${OPTARG};; +h) ARCH=${OPTARG};; +esac +done + +EXIT_CODE=1 + +uname -a + +VERSION_NUMBER=`cat $SOURCE_DIR/VERSION_NUMBER | xarg` +echo "Version: $VERSION_NUMBER" +NATIVE_FOLDER=ai/onnxruntime/native/$ARCH + +mkdir -p $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER +mkdir $BINARY_DIR/$ARTIFACT_NAME/jar +echo "Directories created" + +# We are only interested in one jar +# Extract to strip symbols +echo "Extract the original jar" +pushd $BINARY_DIR/$ARTIFACT_NAME/jar +jar xf $BINARY_DIR/$BUILD_CONFIG/java/build/libs/onnxruntime-$VERSION_NUMBER.jar +popd + +echo "Copy debug symbols in a separate file and strip the original binary." + +cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME +cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME + +if [[ $LIB_NAME == *.dylib ]] +then + # ORT LIB + dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME.dSYM + strip -S $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME + ln -s $LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime.dylib + # JNI Lib + dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM + strip -S $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME + ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib +elif [[ $LIB_NAME == *.so.* ]] +then + ln -s $LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime.so + ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.so +fi + +EXIT_CODE=$? + +set -e +exit $EXIT_CODE From a36fe0188f0dbc0cc2b4862386fa9893161d9218 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 13 May 2020 16:19:09 -0700 Subject: [PATCH 12/88] Introduce Java-api packaging pipeline --- .../java-api-packaging-pipelines.yml | 239 ++++++++++++++++++ ...ifacts-package-and-publish-steps-posix.yml | 8 +- ...acts-package-and-publish-steps-windows.yml | 10 +- .../github/linux/java_copy_strip_binary.sh | 6 +- 4 files changed, 253 insertions(+), 10 deletions(-) create mode 100644 tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml new file mode 100644 index 0000000000000..15ffcd9f29e67 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -0,0 +1,239 @@ +jobs: +- job: Linux_C_API_Packaging_CPU_x64 + workspace: + clean: all + timeoutInMinutes: 60 + pool: + vmImage: 'ubuntu-latest' + steps: + - template: templates/set-version-number-variables-step.yml + - task: CmdLine@2 + inputs: + script: | + docker build --pull -t onnxruntime-centos6 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=3.6 -f Dockerfile.centos6 . + workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker + - task: CmdLine@2 + inputs: + script: | + docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --use_openmp --use_java --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest + workingDirectory: $(Build.SourcesDirectory) + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml + parameters: + buildConfig: 'Release' + artifactName: 'onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' + version: '$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' + commitId: $(OnnxRuntimeGitCommitHash) + +- job: Linux_C_API_Packaging_GPU_x64 + workspace: + clean: all + timeoutInMinutes: 60 + pool: 'Linux-GPU-CUDA10' + steps: + - template: templates/set-version-number-variables-step.yml + - task: CmdLine@2 + inputs: + script: | + docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu . + workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker + - task: CmdLine@2 + inputs: + script: | + docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --use_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 + workingDirectory: $(Build.SourcesDirectory) + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml + parameters: + buildConfig: 'Release' + artifactName: 'onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' + version: '$(OnnxRuntimeVersion)' + commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml + + +- job: MacOS_C_API_Packaging_CPU_x64 + workspace: + clean: all + pool: + vmImage: 'macOS-10.14' + steps: + - template: templates/set-version-number-variables-step.yml + + - script: | + sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt' + sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer + python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_java --build_shared_lib --config RelWithDebInfo + displayName: 'Build and Test MacOS' + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml + parameters: + buildConfig: 'RelWithDebInfo' + artifactName: 'onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.$(OnnxRuntimeVersion).dylib' + version: '$(OnnxRuntimeVersion)' + commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml + +- job: Windows_Packaging_CPU + workspace: + clean: all + pool: 'Win-CPU-2019' + timeoutInMinutes: 160 + strategy: + maxParallel: 2 + matrix: +# x86: + #EnvSetupScript: setup_env_x86.bat + #buildArch: x86 + #msbuildArch: x86 + #msbuildPlatform: Win32 + #buildparameter: --x86 + x64: + EnvSetupScript: setup_env.bat + buildArch: x64 + msbuildArch: amd64 + msbuildPlatform: x64 + buildparameter: + + steps: + - template: templates/enable-telemetry.yml + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + addToPath: true + architecture: $(buildArch) + + - task: BatchScript@1 + displayName: 'setup env' + inputs: + filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)' + modifyEnvironment: true + workingFolder: '$(Build.BinariesDirectory)' + + - script: | + python -m pip install -q pyopenssl setuptools wheel numpy scipy + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Install python modules' + - powershell: | + $Env:USE_MSVC_STATIC_RUNTIME=1 + $Env:ONNX_ML=1 + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" + python setup.py bdist_wheel + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' + displayName: 'Install ONNX' + + - template: templates/set-test-data-variables-step.yml + - template: templates/set-version-number-variables-step.yml + - task: PythonScript@0 + displayName: 'Generate cmake config' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --use_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + workingDirectory: '$(Build.BinariesDirectory)' + + + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + platform: $(msbuildPlatform) + configuration: RelWithDebInfo + msbuildArchitecture: $(buildArch) + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true + + + - task: PythonScript@0 + displayName: 'test' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --use_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + workingDirectory: '$(Build.BinariesDirectory)' + + - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml + parameters: + buildConfig: RelWithDebInfo + artifactName: 'onnxruntime-java-win-$(buildArch)-$(OnnxRuntimeVersion)' + commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml + + +- job: Windows_Packaging_GPU + workspace: + clean: all + pool: 'Win-GPU-2019' + timeoutInMinutes: 120 + variables: + EnvSetupScript: setup_env_cuda.bat + buildArch: x64 + msbuildArch: amd64 + msbuildPlatform: x64 + CUDA_VERSION: '10.1' + buildparameter: --use_cuda --cuda_version=$(CUDA_VERSION) --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$(CUDA_VERSION)" --cudnn_home="C:\local\cudnn-$(CUDA_VERSION)-windows10-x64-v7.6.5.32\cuda" + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + addToPath: true + architecture: $(buildArch) + + - task: BatchScript@1 + displayName: 'setup env' + inputs: + filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)' + modifyEnvironment: true + workingFolder: '$(Build.BinariesDirectory)' + + - script: | + python -m pip install -q pyopenssl setuptools wheel numpy scipy + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Install python modules' + - powershell: | + $Env:USE_MSVC_STATIC_RUNTIME=1 + $Env:ONNX_ML=1 + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" + python setup.py bdist_wheel + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' + displayName: 'Install ONNX' + + - template: templates/set-test-data-variables-step.yml + - template: templates/set-version-number-variables-step.yml + + - task: PythonScript@0 + displayName: 'Generate cmake config' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --use_java --build_shared_lib --enable_onnx_tests $(buildparameter)' + workingDirectory: '$(Build.BinariesDirectory)' + + + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + platform: $(msbuildPlatform) + configuration: RelWithDebInfo + msbuildArchitecture: $(buildArch) + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true + + - task: PythonScript@0 + displayName: 'test' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --use_java --build_shared_lib --enable_onnx_tests $(buildparameter)' + workingDirectory: '$(Build.BinariesDirectory)' + + - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml + parameters: + buildConfig: RelWithDebInfo + artifactName: 'onnxruntime-java-win-$(buildArch)-gpu-$(OnnxRuntimeVersion)' + commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml index 225e630e15d2e..be5f77fdf8c17 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -2,15 +2,17 @@ parameters: buildConfig: 'RelWithDebInfo' - artifactName: 'onnxruntime-linux-x64' + artifactName: 'onnxruntime-java-linux-x64' libraryName: 'libonnxruntime.so' + nativeLibraryName: 'libonnxruntime4j_jni.so' + version: '' commitId: '' steps: - task: ShellScript@2 displayName: 'Copy build artifacts for zipping' inputs: - scriptPath: 'tools/ci_build/github/linux/copy_strip_binary.sh' - args: '-r $(Build.BinariesDirectory) -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -c ${{parameters.buildConfig}} -s $(Build.SourcesDirectory) -t ${{parameters.commitId}}' + scriptPath: 'tools/ci_build/github/linux/java_copy_strip_binary.sh' + args: '-r $(Build.BinariesDirectory) -c ${{parameters.buildConfig}} -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -s $(Build.SourcesDirectory) -n {{parameters.nativeLibraryName}} -v {{parameters.version}} -t ${{parameters.commitId}}' workingDirectory: '$(Build.BinariesDirectory)/${{parameters.buildConfig}}' - task: ArchiveFiles@2 diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 936227bd954d6..00ae34a997aa1 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -2,23 +2,25 @@ parameters: buildConfig: 'RelWithDebInfo' - artifactName: 'onnxruntime-win-x64' + artifactName: 'onnxruntime-java-win-x64' comitId: '' steps: - task: CmdLine@2 displayName: 'Copy build artifacts for zipping' inputs: script: | + set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\ai.onnxruntime\win-x64 + mkdir %NATIVE_FOLDER% mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib echo "Directories created" # Copy all jars copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib # We will need to make this a part of a jar - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime4j_jni.pdb $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.pdb %NATIVE_FOLDER% + copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime4j_jni.pdb %NATIVE_FOLDER% - # copy the licence, privacy and TPN + # copy the license, privacy and TPN copy $(Build.SourcesDirectory)\LICENSE $(Build.BinariesDirectory)\${{parameters.artifactName}}\LICENSE copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\Privacy.md copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\${{parameters.artifactName}}\ThirdPartyNotices.txt diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index 043a8bb38dbe7..a132f04acc388 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -1,15 +1,16 @@ #!/bin/bash set -e -o -x -while getopts r:a:l:n:c:h: parameter_Option +while getopts r:a:l:n:c:h:v: parameter_Option do case "${parameter_Option}" in r) BINARY_DIR=${OPTARG};; a) ARTIFACT_NAME=${OPTARG};; +c) BUILD_CONFIG=${OPTARG};; l) LIB_NAME=${OPTARG};; n) NATIVE_LIB_NAME=${OPTARG};; -c) BUILD_CONFIG=${OPTARG};; h) ARCH=${OPTARG};; +v) VERSION_NUMBER=${OPTARG};; esac done @@ -17,7 +18,6 @@ EXIT_CODE=1 uname -a -VERSION_NUMBER=`cat $SOURCE_DIR/VERSION_NUMBER | xarg` echo "Version: $VERSION_NUMBER" NATIVE_FOLDER=ai/onnxruntime/native/$ARCH From 46da842dd40b01588242504c51c96fa8bdbc709b Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 13 May 2020 18:12:11 -0700 Subject: [PATCH 13/88] Add Download, Unzipping and updating the jar --- .../java-api-packaging-pipelines.yml | 98 ++++++++++++++++--- ...acts-package-and-publish-steps-windows.yml | 34 +++---- .../github/linux/java_copy_strip_binary.sh | 2 + 3 files changed, 104 insertions(+), 30 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 15ffcd9f29e67..18aabcb9e3465 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -1,5 +1,5 @@ jobs: -- job: Linux_C_API_Packaging_CPU_x64 +- job: Linux_Java_API_Packaging_CPU_x64 workspace: clean: all timeoutInMinutes: 60 @@ -15,7 +15,7 @@ jobs: - task: CmdLine@2 inputs: script: | - docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --use_openmp --use_java --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest + docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --use_openmp --build_java --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest workingDirectory: $(Build.SourcesDirectory) - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: @@ -24,8 +24,8 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - -- job: Linux_C_API_Packaging_GPU_x64 + +- job: Linux_Java_API_Packaging_GPU_x64 workspace: clean: all timeoutInMinutes: 60 @@ -40,7 +40,7 @@ jobs: - task: CmdLine@2 inputs: script: | - docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --use_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 + docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 workingDirectory: $(Build.SourcesDirectory) - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: @@ -52,7 +52,7 @@ jobs: - template: templates/clean-agent-build-directory-step.yml -- job: MacOS_C_API_Packaging_CPU_x64 +- job: MacOS_Java_API_Packaging_CPU_x64 workspace: clean: all pool: @@ -61,9 +61,14 @@ jobs: - template: templates/set-version-number-variables-step.yml - script: | + export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home + java --version + javac --version + sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt' sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer - python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_java --build_shared_lib --config RelWithDebInfo + python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_java --build_shared_lib --config RelWithDebInfo + displayName: 'Build and Test MacOS' - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: @@ -74,7 +79,7 @@ jobs: commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml -- job: Windows_Packaging_CPU +- job: Windows_Java_Packaging_CPU workspace: clean: all pool: 'Win-CPU-2019' @@ -130,7 +135,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --use_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -151,18 +156,19 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --use_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml parameters: buildConfig: RelWithDebInfo artifactName: 'onnxruntime-java-win-$(buildArch)-$(OnnxRuntimeVersion)' + version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml -- job: Windows_Packaging_GPU +- job: Windows_Java_Packaging_GPU workspace: clean: all pool: 'Win-GPU-2019' @@ -208,7 +214,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --use_java --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_java --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -228,12 +234,78 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --enable_lto --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --use_java --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_java --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml parameters: buildConfig: RelWithDebInfo artifactName: 'onnxruntime-java-win-$(buildArch)-gpu-$(OnnxRuntimeVersion)' + version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml + +- job: Jar_Packaging + workspace: + clean: all + pool: 'Win-CPU-2019' + dependsOn: + - Windows_Java_Packaging_CPU +# - Windows_Java_Packaging_GPU + - Linux_Java_API_Packaging_CPU_x64 +# - Linux_C_API_Packaging_GPU_x64 + - MacOS_Java_API_Packaging_CPU_x64 + condition: succeeded() + steps: + + - task: DownloadPipelineArtifact@0 + displayName: 'Download Pipeline Artifact - Win x64' + inputs: + artifactName: 'drop-onnxruntime-java-win-x64-$(OnnxRuntimeVersion)' + targetPath: '$(Build.BinariesDirectory)/java-artifact' + + - task: DownloadPipelineArtifact@0 + displayName: 'Download Pipeline Artifact - Linux x64' + inputs: + artifactName: 'drop-onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' + targetPath: '$(Build.BinariesDirectory)/java-artifact' + + - task: DownloadPipelineArtifact@0 + displayName: 'Download Pipeline Artifact - MacOS x64' + inputs: + artifactName: 'drop-onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' + targetPath: '$(Build.BinariesDirectory)/java-artifact' + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-win-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64' + cleanDestinationFolder: true + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-linux-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64' + cleanDestinationFolder: true + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-osx-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/osx-x64' + cleanDestinationFolder: true + + - task: CmdLine@2 + displayName: 'Add Windows, Linux, OSX binaries to a single jar' + inputs: + script: | + pushd linux-x64\lib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + popd + pushd osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM + popd + workingDirectory: '$(Build.BinariesDirectory)\java-artifact' diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 00ae34a997aa1..695c2f663ef10 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -3,37 +3,37 @@ parameters: buildConfig: 'RelWithDebInfo' artifactName: 'onnxruntime-java-win-x64' + version: '' comitId: '' steps: - task: CmdLine@2 displayName: 'Copy build artifacts for zipping' inputs: script: | - set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\ai.onnxruntime\win-x64 + set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ai\onnxruntime\native\win-x64 mkdir %NATIVE_FOLDER% - mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\ echo "Directories created" - - # Copy all jars - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - # We will need to make this a part of a jar - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime.pdb %NATIVE_FOLDER% - copy $(Build.BinariesDirectory)\${{parameters.buildConfig}}\${{parameters.buildConfig}}\onnxruntime4j_jni.pdb %NATIVE_FOLDER% - - # copy the license, privacy and TPN - copy $(Build.SourcesDirectory)\LICENSE $(Build.BinariesDirectory)\${{parameters.artifactName}}\LICENSE - copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\Privacy.md - copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\${{parameters.artifactName}}\ThirdPartyNotices.txt - @echo ${{parameters.commitId}} > $(Build.BinariesDirectory)\${{parameters.artifactName}}\GIT_COMMIT_ID - + copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy .\${{parameters.buildConfig}}\onnxruntime.pdb %NATIVE_FOLDER% + copy .\${{parameters.buildConfig}}\onnxruntime4j_jni.pdb %NATIVE_FOLDER% + copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\Privacy.md + copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ThirdPartyNotices.txt + @echo ${{parameters.commitId}} > $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\GIT_COMMIT_ID + dir /s /b . + pushd $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime.pdb + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib\onnxruntime-${{parameters.version}}.jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID + popd workingDirectory: '$(Build.BinariesDirectory)\${{parameters.buildConfig}}' - task: ArchiveFiles@2 inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)\${{parameters.artifactName}}' + rootFolderOrFile: '$(Build.BinariesDirectory)\${{parameters.artifactName}}\lib' includeRootFolder: true archiveType: 'zip' # Options: zip, 7z, tar, wim - archiveFile: '$(Build.ArtifactStagingDirectory)\${{parameters.artifactName}}.zip' + archiveFile: '$(Build.ArtifactStagingDirectory)\${{parameters.artifactName}}.zip' replaceExistingArchive: true - task: PublishBuildArtifacts@1 diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index a132f04acc388..e5e4c5bd7c2e4 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -53,6 +53,8 @@ then ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.so fi +find $BINARY_DIR/$ARTIFACT_NAME -ls + EXIT_CODE=$? set -e From 0b4399deba7307345a976dbbc3e9b61a62ae8135 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 10:37:23 -0700 Subject: [PATCH 14/88] Modify build settings add publishing to pipeline --- .../java-api-packaging-pipelines.yml | 44 ++++++++++++------- ...ifacts-package-and-publish-steps-posix.yml | 9 ++-- ...acts-package-and-publish-steps-windows.yml | 5 +++ .../github/linux/java_copy_strip_binary.sh | 6 +-- 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 18aabcb9e3465..003362c123473 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -1,5 +1,5 @@ jobs: -- job: Linux_Java_API_Packaging_CPU_x64 +- job: Linux_Java_API_Build_CPU_x64 workspace: clean: all timeoutInMinutes: 60 @@ -7,6 +7,8 @@ jobs: vmImage: 'ubuntu-latest' steps: - template: templates/set-version-number-variables-step.yml + - template: ../../templates/linux-set-variables-and-download.yml + - task: CmdLine@2 inputs: script: | @@ -15,7 +17,8 @@ jobs: - task: CmdLine@2 inputs: script: | - docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --use_openmp --build_java --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest + script: | + docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /bin/bash -c "/usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --build_java --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --enable_onnx_tests && cd /build/Release && make install DESTDIR=/build/linux-x64" workingDirectory: $(Build.SourcesDirectory) - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: @@ -25,7 +28,8 @@ jobs: libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) -- job: Linux_Java_API_Packaging_GPU_x64 +# This job is not used yet as we do not have Java for GPU ready. +- job: Linux_Java_API_Build_GPU_x64 workspace: clean: all timeoutInMinutes: 60 @@ -52,7 +56,7 @@ jobs: - template: templates/clean-agent-build-directory-step.yml -- job: MacOS_Java_API_Packaging_CPU_x64 +- job: MacOS_Java_API_Build_CPU_x64 workspace: clean: all pool: @@ -67,7 +71,7 @@ jobs: sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt' sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer - python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_java --build_shared_lib --config RelWithDebInfo + python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_java --build_shared_lib --use_openmp --config RelWithDebInfo' displayName: 'Build and Test MacOS' - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -79,7 +83,7 @@ jobs: commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml -- job: Windows_Java_Packaging_CPU +- job: Windows_Java_Build_CPU_x64 workspace: clean: all pool: 'Win-CPU-2019' @@ -120,12 +124,13 @@ jobs: python -m pip install -q pyopenssl setuptools wheel numpy scipy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' + - powershell: | - $Env:USE_MSVC_STATIC_RUNTIME=1 - $Env:ONNX_ML=1 - $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" - python setup.py bdist_wheel - Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + $Env:USE_MSVC_STATIC_RUNTIME=1 + $Env:ONNX_ML=1 + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.BuildArch }}-windows-static" + python setup.py bdist_wheel + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' displayName: 'Install ONNX' @@ -135,7 +140,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -156,7 +161,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -167,7 +172,7 @@ jobs: commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml - +# Job does not run as we are not ready for GPU - job: Windows_Java_Packaging_GPU workspace: clean: all @@ -294,10 +299,10 @@ jobs: destinationFolder: '$(Build.BinariesDirectory)/java-artifact/osx-x64' cleanDestinationFolder: true - - task: CmdLine@2 + - task: CmdLine@2 displayName: 'Add Windows, Linux, OSX binaries to a single jar' inputs: - script: | + script: | pushd linux-x64\lib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so @@ -309,3 +314,10 @@ jobs: jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.BinariesDirectory)\java-artifact\win-x64' + artifact: 'onnxruntime-java' + publishLocation: 'pipeline' + diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml index be5f77fdf8c17..e3fea15ae97a0 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -17,14 +17,13 @@ steps: - task: ArchiveFiles@2 inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)/${{parameters.artifactName}}' + rootFolderOrFile: '$(Build.BinariesDirectory)/${{parameters.artifactName}}/lib' includeRootFolder: true - archiveType: 'tar' # Options: zip, 7z, tar, wim - tarCompression: 'gz' - archiveFile: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.tgz' + archiveType: 'zip' # Options: zip, 7z, tar, wim + archiveFile: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.zip' replaceExistingArchive: true - task: PublishBuildArtifacts@1 inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.tgz' + pathtoPublish: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.zip' artifactName: 'drop-${{parameters.artifactName}}' diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 695c2f663ef10..9f92005f26e5b 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -15,6 +15,11 @@ steps: mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\ echo "Directories created" copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + pushd $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + jar xf onnxruntime-${{parameters.version}}.jar META-INF\maven\ai.onnxruntime\onnxruntime\pom.xml + move META-INF\maven\ai.onnxruntime\onnxruntime\pom.xml onnxruntime-${{parameters.version}}.pom + rd /s /q META-INF + popd copy .\${{parameters.buildConfig}}\onnxruntime.pdb %NATIVE_FOLDER% copy .\${{parameters.buildConfig}}\onnxruntime4j_jni.pdb %NATIVE_FOLDER% copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\Privacy.md diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index e5e4c5bd7c2e4..c7e79894735bc 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -42,15 +42,13 @@ then # ORT LIB dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME - ln -s $LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime.dylib # JNI Lib dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME - ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib elif [[ $LIB_NAME == *.so.* ]] then - ln -s $LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime.so - ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.so +# ln -s $LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime.so +# ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.so fi find $BINARY_DIR/$ARTIFACT_NAME -ls From 0abefa93ecc2dfaf3b772174542416815dffe488 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 11:12:13 -0700 Subject: [PATCH 15/88] Fix first error. --- .../java-api-packaging-pipelines.yml | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 003362c123473..e7d74bfb24966 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -16,7 +16,6 @@ jobs: workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker - task: CmdLine@2 inputs: - script: | script: | docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /bin/bash -c "/usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --build_java --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --enable_onnx_tests && cd /build/Release && make install DESTDIR=/build/linux-x64" workingDirectory: $(Build.SourcesDirectory) @@ -302,17 +301,17 @@ jobs: - task: CmdLine@2 displayName: 'Add Windows, Linux, OSX binaries to a single jar' inputs: - script: | - pushd linux-x64\lib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so - popd - pushd osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM - popd + script: | + pushd linux-x64\lib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + popd + pushd osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM + popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - task: PublishPipelineArtifact@1 From e3789b7075838cd64bb6ec0a41b9f3bd73fd2ebd Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 11:26:30 -0700 Subject: [PATCH 16/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Remove name from the CmdScript --- .../java-api-packaging-pipelines.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index e7d74bfb24966..71bb1af01077a 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -298,21 +298,21 @@ jobs: destinationFolder: '$(Build.BinariesDirectory)/java-artifact/osx-x64' cleanDestinationFolder: true + - task: CmdLine@2 - displayName: 'Add Windows, Linux, OSX binaries to a single jar' - inputs: - script: | - pushd linux-x64\lib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so - popd - pushd osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM - popd - workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + inputs: + script: | + pushd linux-x64\lib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + popd + pushd osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM + popd + workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - task: PublishPipelineArtifact@1 inputs: From d7150feaa88f6a573b6e1d87c4200f7723e01616 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 11:53:23 -0700 Subject: [PATCH 17/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Align script params --- .../java-api-packaging-pipelines.yml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 71bb1af01077a..c733f474d1e67 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -303,16 +303,16 @@ jobs: inputs: script: | pushd linux-x64\lib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so - popd - pushd osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM - popd - workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + popd + pushd osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM + popd + workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - task: PublishPipelineArtifact@1 inputs: From f7f55bfbc1c43542be18b9b574daf1f7b92eb283 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 11:53:52 -0700 Subject: [PATCH 18/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Align script params --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index c733f474d1e67..282793f1b6412 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -312,7 +312,7 @@ jobs: jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM popd - workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - task: PublishPipelineArtifact@1 inputs: From 66dc196612f201e28ab2003fd3a8a7b2926ec937 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 11:55:08 -0700 Subject: [PATCH 19/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Align script params too script --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 282793f1b6412..662a0458724fb 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -312,7 +312,7 @@ jobs: jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM popd - workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - task: PublishPipelineArtifact@1 inputs: From 836fce2a5fba2414931936de5b7725a84538e760 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 11:55:53 -0700 Subject: [PATCH 20/88] Remove DisplayName from the script --- .../java-api-artifacts-package-and-publish-steps-windows.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 9f92005f26e5b..0decf738062b3 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -7,7 +7,6 @@ parameters: comitId: '' steps: - task: CmdLine@2 - displayName: 'Copy build artifacts for zipping' inputs: script: | set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ai\onnxruntime\native\win-x64 From 48c70dba75bad6becb0879a7c039a243128a12e9 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 12:01:46 -0700 Subject: [PATCH 21/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Fix subscript path --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 662a0458724fb..33289d35aea39 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -7,7 +7,7 @@ jobs: vmImage: 'ubuntu-latest' steps: - template: templates/set-version-number-variables-step.yml - - template: ../../templates/linux-set-variables-and-download.yml + - template: templates/linux-set-variables-and-download.yml - task: CmdLine@2 inputs: From c71a1d4b10f897bd52b5941f403afecfe9b6651b Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 12:40:59 -0700 Subject: [PATCH 22/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Fix buildArch reference --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 33289d35aea39..e730c43407289 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -127,7 +127,7 @@ jobs: - powershell: | $Env:USE_MSVC_STATIC_RUNTIME=1 $Env:ONNX_ML=1 - $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.BuildArch }}-windows-static" + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" python setup.py bdist_wheel Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' @@ -313,6 +313,7 @@ jobs: jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + displayName: 'Create final Jar' - task: PublishPipelineArtifact@1 inputs: From 5bcf1b0efeaede34b34f8aa1b934eaacd0e33103 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 12:51:58 -0700 Subject: [PATCH 23/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Adjust job and dependancy names --- .../java-api-packaging-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index e730c43407289..4d840fedc230c 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -82,7 +82,7 @@ jobs: commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml -- job: Windows_Java_Build_CPU_x64 +- job: Windows_Java_API_Build_CPU_x64 workspace: clean: all pool: 'Win-CPU-2019' @@ -172,7 +172,7 @@ jobs: - template: templates/clean-agent-build-directory-step.yml # Job does not run as we are not ready for GPU -- job: Windows_Java_Packaging_GPU +- job: Windows_Java_API_Build_GPU_x64 workspace: clean: all pool: 'Win-GPU-2019' @@ -254,11 +254,11 @@ jobs: clean: all pool: 'Win-CPU-2019' dependsOn: - - Windows_Java_Packaging_CPU -# - Windows_Java_Packaging_GPU - - Linux_Java_API_Packaging_CPU_x64 -# - Linux_C_API_Packaging_GPU_x64 - - MacOS_Java_API_Packaging_CPU_x64 + - Windows_Java_API_Build_CPU_x64 +# - Windows_Java_API_Build_GPU_x64 + - Linux_Java_API_Build_CPU_x64 +# - Linux_Java_API_Build_GPU_x64 + - MacOS_Java_API_Build_CPU_x64 condition: succeeded() steps: From c8a05a6cf9488f7479f94a952b94077e6ebdda92 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 12:56:15 -0700 Subject: [PATCH 24/88] Update java-api-packaging-pipelines.yml for Azure Pipelines Remove GPU pipelines --- .../java-api-packaging-pipelines.yml | 108 ------------------ 1 file changed, 108 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 4d840fedc230c..4680f843f7066 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -27,34 +27,6 @@ jobs: libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) -# This job is not used yet as we do not have Java for GPU ready. -- job: Linux_Java_API_Build_GPU_x64 - workspace: - clean: all - timeoutInMinutes: 60 - pool: 'Linux-GPU-CUDA10' - steps: - - template: templates/set-version-number-variables-step.yml - - task: CmdLine@2 - inputs: - script: | - docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu . - workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker - - task: CmdLine@2 - inputs: - script: | - docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 - workingDirectory: $(Build.SourcesDirectory) - - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml - parameters: - buildConfig: 'Release' - artifactName: 'onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' - libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' - version: '$(OnnxRuntimeVersion)' - commitId: $(OnnxRuntimeGitCommitHash) - - template: templates/clean-agent-build-directory-step.yml - - - job: MacOS_Java_API_Build_CPU_x64 workspace: clean: all @@ -171,93 +143,13 @@ jobs: commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml -# Job does not run as we are not ready for GPU -- job: Windows_Java_API_Build_GPU_x64 - workspace: - clean: all - pool: 'Win-GPU-2019' - timeoutInMinutes: 120 - variables: - EnvSetupScript: setup_env_cuda.bat - buildArch: x64 - msbuildArch: amd64 - msbuildPlatform: x64 - CUDA_VERSION: '10.1' - buildparameter: --use_cuda --cuda_version=$(CUDA_VERSION) --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$(CUDA_VERSION)" --cudnn_home="C:\local\cudnn-$(CUDA_VERSION)-windows10-x64-v7.6.5.32\cuda" - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - addToPath: true - architecture: $(buildArch) - - - task: BatchScript@1 - displayName: 'setup env' - inputs: - filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)' - modifyEnvironment: true - workingFolder: '$(Build.BinariesDirectory)' - - - script: | - python -m pip install -q pyopenssl setuptools wheel numpy scipy - workingDirectory: '$(Build.BinariesDirectory)' - displayName: 'Install python modules' - - powershell: | - $Env:USE_MSVC_STATIC_RUNTIME=1 - $Env:ONNX_ML=1 - $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" - python setup.py bdist_wheel - Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} - workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' - displayName: 'Install ONNX' - - - template: templates/set-test-data-variables-step.yml - - template: templates/set-version-number-variables-step.yml - - - task: PythonScript@0 - displayName: 'Generate cmake config' - inputs: - scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_java --build_shared_lib --enable_onnx_tests $(buildparameter)' - workingDirectory: '$(Build.BinariesDirectory)' - - - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' - platform: $(msbuildPlatform) - configuration: RelWithDebInfo - msbuildArchitecture: $(buildArch) - maximumCpuCount: true - logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' - createLogFile: true - - - task: PythonScript@0 - displayName: 'test' - inputs: - scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_java --build_shared_lib --enable_onnx_tests $(buildparameter)' - workingDirectory: '$(Build.BinariesDirectory)' - - - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml - parameters: - buildConfig: RelWithDebInfo - artifactName: 'onnxruntime-java-win-$(buildArch)-gpu-$(OnnxRuntimeVersion)' - version: '$(OnnxRuntimeVersion)' - commitId: $(OnnxRuntimeGitCommitHash) - - template: templates/clean-agent-build-directory-step.yml - - job: Jar_Packaging workspace: clean: all pool: 'Win-CPU-2019' dependsOn: - Windows_Java_API_Build_CPU_x64 -# - Windows_Java_API_Build_GPU_x64 - Linux_Java_API_Build_CPU_x64 -# - Linux_Java_API_Build_GPU_x64 - MacOS_Java_API_Build_CPU_x64 condition: succeeded() steps: From 7dbeccbcba6b17c10440b421018383dc61cab162 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 14:49:42 -0700 Subject: [PATCH 25/88] Fix pipeline issues. Install openjdk8 to centos6 docker image. --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 5 ++--- .../java-api-artifacts-package-and-publish-steps-windows.yml | 2 +- tools/ci_build/github/linux/docker/Dockerfile.centos6 | 3 ++- tools/ci_build/github/linux/docker/scripts/install_centos.sh | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 4680f843f7066..154462d4d4c4e 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -39,10 +39,9 @@ jobs: export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home java --version javac --version - sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt' sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer - python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_java --build_shared_lib --use_openmp --config RelWithDebInfo' + python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_java --build_shared_lib --use_openmp --config RelWithDebInfo displayName: 'Build and Test MacOS' - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -198,7 +197,7 @@ jobs: jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd - pushd osx-x64 + pushd osx-x64\lib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 0decf738062b3..eb5b5059d8068 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -11,7 +11,7 @@ steps: script: | set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ai\onnxruntime\native\win-x64 mkdir %NATIVE_FOLDER% - mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\ + mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib echo "Directories created" copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib pushd $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6 b/tools/ci_build/github/linux/docker/Dockerfile.centos6 index 3a13e5e9f3578..08340747b4b26 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6 +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6 @@ -2,7 +2,8 @@ FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-6-50f0d02-20190918213956 ADD scripts /tmp/scripts RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh -ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${PATH} +ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 +ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts ARG BUILD_UID=1000 diff --git a/tools/ci_build/github/linux/docker/scripts/install_centos.sh b/tools/ci_build/github/linux/docker/scripts/install_centos.sh index 5b779c4cd56ff..5d38d35d418b1 100755 --- a/tools/ci_build/github/linux/docker/scripts/install_centos.sh +++ b/tools/ci_build/github/linux/docker/scripts/install_centos.sh @@ -31,6 +31,7 @@ else fi fi + yum install -y java-1.8.0-openjdk-devel #If the /opt/python folder exists, we assume this is the manylinux docker image if [ "$os_major_version" != "6" ] && [ ! -d "/opt/python/cp35-cp35m" ] From 8fe7b88caae8408c2d90c849ce5159adbd875deb Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 14 May 2020 17:13:19 -0700 Subject: [PATCH 26/88] Adjust packaging, fix script errors. --- .../java-api-packaging-pipelines.yml | 11 +++++++---- ...ifacts-package-and-publish-steps-posix.yml | 4 ++-- ...acts-package-and-publish-steps-windows.yml | 17 +++++++++-------- .../github/linux/java_copy_strip_binary.sh | 19 +++++++++---------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 154462d4d4c4e..9f464bee3bf4b 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -14,17 +14,20 @@ jobs: script: | docker build --pull -t onnxruntime-centos6 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=3.6 -f Dockerfile.centos6 . workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker + displayName: 'Build CentoOS6 docker image' - task: CmdLine@2 inputs: script: | docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /bin/bash -c "/usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --build_java --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --enable_onnx_tests && cd /build/Release && make install DESTDIR=/build/linux-x64" workingDirectory: $(Build.SourcesDirectory) + displayName: 'Run build and test' + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: buildConfig: 'Release' artifactName: 'onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' version: '$(OnnxRuntimeVersion)' - libraryName: 'libonnxruntime.so.$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.so' commitId: $(OnnxRuntimeGitCommitHash) - job: MacOS_Java_API_Build_CPU_x64 @@ -48,7 +51,7 @@ jobs: parameters: buildConfig: 'RelWithDebInfo' artifactName: 'onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' - libraryName: 'libonnxruntime.$(OnnxRuntimeVersion).dylib' + libraryName: 'libonnxruntime.dylib' version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml @@ -193,11 +196,11 @@ jobs: - task: CmdLine@2 inputs: script: | - pushd linux-x64\lib + pushd linux-x64 jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd - pushd osx-x64\lib + pushd osx-x64 jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml index e3fea15ae97a0..5d1d5a3ad4ca2 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -12,12 +12,12 @@ steps: displayName: 'Copy build artifacts for zipping' inputs: scriptPath: 'tools/ci_build/github/linux/java_copy_strip_binary.sh' - args: '-r $(Build.BinariesDirectory) -c ${{parameters.buildConfig}} -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -s $(Build.SourcesDirectory) -n {{parameters.nativeLibraryName}} -v {{parameters.version}} -t ${{parameters.commitId}}' + args: '-r $(Build.BinariesDirectory) -c ${{parameters.buildConfig}} -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -n ${{parameters.nativeLibraryName}} -v ${{parameters.version}} -t ${{parameters.commitId}}' workingDirectory: '$(Build.BinariesDirectory)/${{parameters.buildConfig}}' - task: ArchiveFiles@2 inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)/${{parameters.artifactName}}/lib' + rootFolderOrFile: '$(Build.BinariesDirectory)/${{parameters.artifactName}}' includeRootFolder: true archiveType: 'zip' # Options: zip, 7z, tar, wim archiveFile: '$(Build.ArtifactStagingDirectory)/${{parameters.artifactName}}.zip' diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index eb5b5059d8068..d1c73662ad379 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -11,10 +11,9 @@ steps: script: | set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ai\onnxruntime\native\win-x64 mkdir %NATIVE_FOLDER% - mkdir $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib echo "Directories created" - copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib - pushd $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib + copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}} + pushd $(Build.BinariesDirectory)\${{parameters.artifactName}} jar xf onnxruntime-${{parameters.version}}.jar META-INF\maven\ai.onnxruntime\onnxruntime\pom.xml move META-INF\maven\ai.onnxruntime\onnxruntime\pom.xml onnxruntime-${{parameters.version}}.pom rd /s /q META-INF @@ -24,17 +23,19 @@ steps: copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\Privacy.md copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ThirdPartyNotices.txt @echo ${{parameters.commitId}} > $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\GIT_COMMIT_ID - dir /s /b . pushd $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage - jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime.pdb - jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb - jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\lib\onnxruntime-${{parameters.version}}.jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime.pdb + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\onnxruntime-${{parameters.version}}.jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID popd + rd /s /q $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage + dir /s /b $(Build.BinariesDirectory)\${{parameters.artifactName}} workingDirectory: '$(Build.BinariesDirectory)\${{parameters.buildConfig}}' + displayName: 'Add symbols and notices' - task: ArchiveFiles@2 inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)\${{parameters.artifactName}}\lib' + rootFolderOrFile: '$(Build.BinariesDirectory)\${{parameters.artifactName}}' includeRootFolder: true archiveType: 'zip' # Options: zip, 7z, tar, wim archiveFile: '$(Build.ArtifactStagingDirectory)\${{parameters.artifactName}}.zip' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index c7e79894735bc..a2be4adbfb3c0 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -21,7 +21,7 @@ uname -a echo "Version: $VERSION_NUMBER" NATIVE_FOLDER=ai/onnxruntime/native/$ARCH -mkdir -p $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER +mkdir -p $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER mkdir $BINARY_DIR/$ARTIFACT_NAME/jar echo "Directories created" @@ -34,21 +34,20 @@ popd echo "Copy debug symbols in a separate file and strip the original binary." -cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME -cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME - if [[ $LIB_NAME == *.dylib ]] then # ORT LIB - dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME.dSYM - strip -S $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$LIB_NAME + dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME.dSYM + strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME + ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$LIB_NAME # JNI Lib - dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM - strip -S $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/$NATIVE_LIB_NAME + dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM + strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME + ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_LIB_NAME elif [[ $LIB_NAME == *.so.* ]] then -# ln -s $LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime.so -# ln -s $NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/lib/$NATIVE_FOLDER/libonnxruntime4j_jni.so + ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME + ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME fi find $BINARY_DIR/$ARTIFACT_NAME -ls From fec54ea24ec5d506b183052a38e0737a15d524cb Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 10:16:29 -0700 Subject: [PATCH 27/88] Add gradle to the path. Rework native library copy/strip. --- .../azure-pipelines/java-api-packaging-pipelines.yml | 12 ++++++------ .../ci_build/github/linux/docker/Dockerfile.centos6 | 1 + .../github/linux/docker/Dockerfile.centos6_gpu | 4 +++- .../github/linux/docker/scripts/install_deps.sh | 6 +++--- .../ci_build/github/linux/java_copy_strip_binary.sh | 10 ++++++---- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 9f464bee3bf4b..73c28fe545055 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -197,14 +197,14 @@ jobs: inputs: script: | pushd linux-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd pushd osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final Jar' diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6 b/tools/ci_build/github/linux/docker/Dockerfile.centos6 index 08340747b4b26..9347f394adf17 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6 +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6 @@ -5,6 +5,7 @@ RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts +ENV ${PATH}:/usr/local/gradle/bin ARG BUILD_UID=1000 ARG BUILD_USER=onnxruntimedev diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu b/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu index c5005b2f224c5..c8e5ee845da8c 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu @@ -5,8 +5,10 @@ ENV NVIDIA_DRIVER_CAPABILITIES compute,utility ADD scripts /tmp/scripts RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh -ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${PATH} +ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 +ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts +ENV ${PATH}:/usr/local/gradle/bin #Below are copied from https://gitlab.com/nvidia/container-images/cuda/tree/master/dist/centos6 diff --git a/tools/ci_build/github/linux/docker/scripts/install_deps.sh b/tools/ci_build/github/linux/docker/scripts/install_deps.sh index 0bb2e0df9bb59..1aba7104dc434 100755 --- a/tools/ci_build/github/linux/docker/scripts/install_deps.sh +++ b/tools/ci_build/github/linux/docker/scripts/install_deps.sh @@ -93,10 +93,10 @@ else popd fi -GetFile https://downloads.gradle-dn.com/distributions/gradle-6.2-bin.zip /tmp/src/gradle-6.2-bin.zip +GetFile https://downloads.gradle-dn.com/distributions/gradle-6.3-bin.zip /tmp/src/gradle-6.3-bin.zip cd /tmp/src -unzip gradle-6.2-bin.zip -mv /tmp/src/gradle-6.2 /usr/local/gradle +unzip gradle-6.3-bin.zip +mv /tmp/src/gradle-6.3 /usr/local/gradle if ! [ -x "$(command -v protoc)" ]; then source ${0/%install_deps\.sh/install_protobuf\.sh} diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index a2be4adbfb3c0..fad3d53e7397a 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -30,6 +30,7 @@ echo "Directories created" echo "Extract the original jar" pushd $BINARY_DIR/$ARTIFACT_NAME/jar jar xf $BINARY_DIR/$BUILD_CONFIG/java/build/libs/onnxruntime-$VERSION_NUMBER.jar +ls -laR popd echo "Copy debug symbols in a separate file and strip the original binary." @@ -39,18 +40,19 @@ then # ORT LIB dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME - ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$LIB_NAME + cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/libonnxruntime.dylib # JNI Lib dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME - ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_LIB_NAME + cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/libonnxruntime4j_jni.dylib elif [[ $LIB_NAME == *.so.* ]] then - ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME - ln -s $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME + cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.so + cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.so fi find $BINARY_DIR/$ARTIFACT_NAME -ls +rm -fr $BINARY_DIR/$ARTIFACT_NAME/jar EXIT_CODE=$? From faf63d3985dbdd7de190e3c96df4a7ea37e6b6c2 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 10:23:23 -0700 Subject: [PATCH 28/88] Fix ENV stmt --- tools/ci_build/github/linux/docker/Dockerfile.centos6 | 2 +- tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6 b/tools/ci_build/github/linux/docker/Dockerfile.centos6 index 9347f394adf17..41a9e50eafa53 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6 +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6 @@ -5,7 +5,7 @@ RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts -ENV ${PATH}:/usr/local/gradle/bin +ENV PATH ${PATH}:/usr/local/gradle/bin ARG BUILD_UID=1000 ARG BUILD_USER=onnxruntimedev diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu b/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu index c8e5ee845da8c..9bf4e609df5f2 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu @@ -8,7 +8,7 @@ RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts -ENV ${PATH}:/usr/local/gradle/bin +ENV PATH ${PATH}:/usr/local/gradle/bin #Below are copied from https://gitlab.com/nvidia/container-images/cuda/tree/master/dist/centos6 From 78b47be53aecf9075c25404d2b44b6c82256948d Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 12:06:45 -0700 Subject: [PATCH 29/88] Introduce GPU pipeline. Fix parameters passed to native DLL extraction. --- cmake/CMakeLists.txt | 4 +- .../java-api-packaging-pipelines-gpu.yml | 101 ++++++++++++++++++ .../java-api-packaging-pipelines.yml | 6 +- ...ifacts-package-and-publish-steps-posix.yml | 4 +- 4 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0daa23235c724..12babf2d7740d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -15,12 +15,14 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment ve # Project project(onnxruntime C CXX) +# Needed for Java +set (CMAKE_C_STANDARD 99) include(CheckCXXCompilerFlag) include(CheckLanguage) # CentOS compiler is old but it does allow certain C++14 features -# such as lambda captures and they are convinient +# such as lambda captures and they are convenient # On the other hand it does not allow some others. # So we cant' regulate simply with the standard. set(CMAKE_CXX_STANDARD 14) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml new file mode 100644 index 0000000000000..913bf7e9c10a3 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -0,0 +1,101 @@ +- job: Linux_Java_API_Build_GPU_x64 + workspace: + clean: all + timeoutInMinutes: 60 + pool: 'Linux-GPU-CUDA10' + steps: + - template: templates/set-version-number-variables-step.yml + - task: CmdLine@2 + inputs: + script: | + docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu . + workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker + - task: CmdLine@2 + inputs: + script: | + docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 + workingDirectory: $(Build.SourcesDirectory) + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml + parameters: + arch: 'linux-x64' + buildConfig: 'Release' + artifactName: 'onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.so' + version: '$(OnnxRuntimeVersion)' + - template: templates/clean-agent-build-directory-step.yml + +- job: Windows_Java_API_Build_GPU_x64 + workspace: + clean: all + pool: 'Win-GPU-2019' + timeoutInMinutes: 120 + variables: + EnvSetupScript: setup_env_cuda.bat + buildArch: x64 + msbuildArch: amd64 + msbuildPlatform: x64 + buildparameter: --use_cuda --cuda_version=10.1 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1" --cudnn_home="C:\local\cudnn-10.1-windows10-x64-v7.6.5.32\cuda" + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + addToPath: true + architecture: $(buildArch) + + - task: BatchScript@1 + displayName: 'setup env' + inputs: + filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)' + modifyEnvironment: true + workingFolder: '$(Build.BinariesDirectory)' + + - script: | + python -m pip install -q pyopenssl setuptools wheel numpy scipy + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Install python modules' + - powershell: | + $Env:USE_MSVC_STATIC_RUNTIME=1 + $Env:ONNX_ML=1 + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" + python setup.py bdist_wheel + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' + displayName: 'Install ONNX' + + - template: templates/set-test-data-variables-step.yml + - template: templates/set-version-number-variables-step.yml + + - task: PythonScript@0 + displayName: 'Generate cmake config' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + workingDirectory: '$(Build.BinariesDirectory)' + + + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + platform: $(msbuildPlatform) + configuration: RelWithDebInfo + msbuildArchitecture: $(buildArch) + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true + + - task: PythonScript@0 + displayName: 'test' + inputs: + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: --config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + workingDirectory: '$(Build.BinariesDirectory)' + + - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml + parameters: + buildConfig: RelWithDebInfo + artifactName: 'onnxruntime-java-win-$(buildArch)-gpu-$(OnnxRuntimeVersion)' + version: '$(OnnxRuntimeVersion)' + commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 73c28fe545055..fa1d02cdd81df 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -24,11 +24,11 @@ jobs: - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: + arch: 'linux-x64' buildConfig: 'Release' artifactName: 'onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' - commitId: $(OnnxRuntimeGitCommitHash) - job: MacOS_Java_API_Build_CPU_x64 workspace: @@ -49,11 +49,11 @@ jobs: displayName: 'Build and Test MacOS' - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: + arch: 'osx-x64' buildConfig: 'RelWithDebInfo' artifactName: 'onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.dylib' version: '$(OnnxRuntimeVersion)' - commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml - job: Windows_Java_API_Build_CPU_x64 @@ -113,7 +113,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml index 5d1d5a3ad4ca2..ed020758fae3e 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -1,18 +1,18 @@ # sets up common build tools for the windows build machines before build parameters: + arch: 'linux-x64' buildConfig: 'RelWithDebInfo' artifactName: 'onnxruntime-java-linux-x64' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' version: '' - commitId: '' steps: - task: ShellScript@2 displayName: 'Copy build artifacts for zipping' inputs: scriptPath: 'tools/ci_build/github/linux/java_copy_strip_binary.sh' - args: '-r $(Build.BinariesDirectory) -c ${{parameters.buildConfig}} -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -n ${{parameters.nativeLibraryName}} -v ${{parameters.version}} -t ${{parameters.commitId}}' + args: '-r $(Build.BinariesDirectory) -c ${{parameters.buildConfig}} -a ${{parameters.artifactName}} -l ${{parameters.libraryName}} -n ${{parameters.nativeLibraryName}} -v ${{parameters.version}} -h ${{parameters.arch}}' workingDirectory: '$(Build.BinariesDirectory)/${{parameters.buildConfig}}' - task: ArchiveFiles@2 From c95e8097b03ea93c68ad468e64a2b41bb6d4204b Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 14:21:42 -0700 Subject: [PATCH 30/88] Adjust the script and Linuix pools. --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 5 ++--- tools/ci_build/github/linux/java_copy_strip_binary.sh | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index fa1d02cdd81df..6712877fcd5cb 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -3,8 +3,7 @@ jobs: workspace: clean: all timeoutInMinutes: 60 - pool: - vmImage: 'ubuntu-latest' + pool: 'Linux-CPU' steps: - template: templates/set-version-number-variables-step.yml - template: templates/linux-set-variables-and-download.yml @@ -113,7 +112,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index fad3d53e7397a..aa501ec7c2422 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -40,11 +40,11 @@ then # ORT LIB dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME - cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/libonnxruntime.dylib + cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.dylib # JNI Lib dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME - cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/libonnxruntime4j_jni.dylib + cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib elif [[ $LIB_NAME == *.so.* ]] then cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.so From f3f0daae47015948c9e64560bf124afba7b8d184 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 15:43:50 -0700 Subject: [PATCH 31/88] Fix Java HOME env and Path. Add missing parameter. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 3 ++- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 4 +++- tools/ci_build/github/linux/docker/Dockerfile.centos6 | 2 +- tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 913bf7e9c10a3..1f6f2c1b7e812 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -20,8 +20,9 @@ arch: 'linux-x64' buildConfig: 'Release' artifactName: 'onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' - libraryName: 'libonnxruntime.so' version: '$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.so' + nativeLibraryName: 'libonnxruntime4j_jni.so' - template: templates/clean-agent-build-directory-step.yml - job: Windows_Java_API_Build_GPU_x64 diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 6712877fcd5cb..92755cd57f841 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -28,6 +28,7 @@ jobs: artifactName: 'onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' + nativeLibraryName: 'libonnxruntime4j_jni.so' - job: MacOS_Java_API_Build_CPU_x64 workspace: @@ -51,8 +52,9 @@ jobs: arch: 'osx-x64' buildConfig: 'RelWithDebInfo' artifactName: 'onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' - libraryName: 'libonnxruntime.dylib' version: '$(OnnxRuntimeVersion)' + libraryName: 'libonnxruntime.dylib' + nativeLibraryName: 'libonnxruntime4j_jni.dylib' - template: templates/clean-agent-build-directory-step.yml - job: Windows_Java_API_Build_CPU_x64 diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6 b/tools/ci_build/github/linux/docker/Dockerfile.centos6 index 41a9e50eafa53..a52cf3192894e 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6 +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6 @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet-buildtools/prereqs:centos-6-50f0d02-20190918213956 ADD scripts /tmp/scripts RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh -ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 +ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk.x86_64 ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts ENV PATH ${PATH}:/usr/local/gradle/bin diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu b/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu index 9bf4e609df5f2..adcbaaf7479a6 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6_gpu @@ -5,7 +5,7 @@ ENV NVIDIA_DRIVER_CAPABILITIES compute,utility ADD scripts /tmp/scripts RUN cd /tmp/scripts && /tmp/scripts/install_centos.sh -ENV JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64 +ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk.x86_64 ENV PATH /opt/rh/devtoolset-2/root/usr/bin:${JAVA_HOME}/bin:${PATH} RUN /tmp/scripts/install_deps.sh -p 3.6 && rm -rf /tmp/scripts ENV PATH ${PATH}:/usr/local/gradle/bin From 209a2ffe49dfc29215849c8d112b6c42debd376c Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 16:53:57 -0700 Subject: [PATCH 32/88] Add Java --- .../java-api-packaging-pipelines-gpu.yml | 56 +++++++++++++++++++ .../java-api-packaging-pipelines.yml | 4 +- .../github/linux/java_copy_strip_binary.sh | 6 ++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 1f6f2c1b7e812..e24fd19aa9102 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -100,3 +100,59 @@ version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml + +- job: Jar_Packaging + workspace: + clean: all + pool: 'Win-CPU-2019' + dependsOn: + - Windows_Java_API_Build_GPU_x64 + - Linux_Java_API_Build_GPU_x64 + condition: succeeded() + steps: + + - task: DownloadPipelineArtifact@0 + displayName: 'Download Pipeline Artifact - Win x64' + inputs: + artifactName: 'drop-onnxruntime-java-win-x64-$(OnnxRuntimeVersion)' + targetPath: '$(Build.BinariesDirectory)/java-artifact' + + - task: DownloadPipelineArtifact@0 + displayName: 'Download Pipeline Artifact - Linux x64' + inputs: + artifactName: 'drop-onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' + targetPath: '$(Build.BinariesDirectory)/java-artifact' + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-win-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64' + cleanDestinationFolder: true + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-linux-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64' + cleanDestinationFolder: true + + - task: CmdLine@2 + inputs: + script: | + pushd linux-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + popd + pushd osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM + popd + workingDirectory: '$(Build.BinariesDirectory)\java-artifact' + displayName: 'Create final GPU Jar' + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.BinariesDirectory)\java-artifact\win-x64' + artifact: 'onnxruntime-java-gpu' + publishLocation: 'pipeline' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 92755cd57f841..e6223a1f89016 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -204,8 +204,8 @@ jobs: pushd osx-x64 jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final Jar' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index aa501ec7c2422..0b95b7909d3db 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -18,6 +18,12 @@ EXIT_CODE=1 uname -a +# CentOS docker image does not have Java and we need jar here +if [ `uname -s` == 'Linux' ]; then + sudo apt-get install -y openjdk-8-jdk + PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} +fi + echo "Version: $VERSION_NUMBER" NATIVE_FOLDER=ai/onnxruntime/native/$ARCH From ab3433f6f6e0cfedd27e65671d929fa914ff25fb Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 17:02:18 -0700 Subject: [PATCH 33/88] Update java-api-packaging-pipelines-gpu.yml for Azure Pipelines Add jobs on the top --- .../github/azure-pipelines/java-api-packaging-pipelines-gpu.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index e24fd19aa9102..f0784cbbe445c 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -1,3 +1,4 @@ +jobs: - job: Linux_Java_API_Build_GPU_x64 workspace: clean: all From 04561c45f8884e096f3d1a3d74baed37c015e2fe Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 17:03:38 -0700 Subject: [PATCH 34/88] Update java-api-packaging-pipelines-gpu.yml for Azure Pipelines Fix formatting --- .../github/azure-pipelines/java-api-packaging-pipelines-gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index f0784cbbe445c..8f2d33b1a6b1a 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -124,7 +124,7 @@ jobs: artifactName: 'drop-onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' targetPath: '$(Build.BinariesDirectory)/java-artifact' - - task: ExtractFiles@1 + - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-win-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64' From 71ee255b24306fa9e72423219a942535e45b1349 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 18 May 2020 17:18:52 -0700 Subject: [PATCH 35/88] Fix library name match. --- .../java-api-packaging-pipelines-gpu.yml | 11 ++++++----- tools/ci_build/github/linux/java_copy_strip_binary.sh | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 8f2d33b1a6b1a..e28d4ceaa5671 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -55,12 +55,13 @@ jobs: python -m pip install -q pyopenssl setuptools wheel numpy scipy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' + - powershell: | - $Env:USE_MSVC_STATIC_RUNTIME=1 - $Env:ONNX_ML=1 - $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" - python setup.py bdist_wheel - Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + $Env:USE_MSVC_STATIC_RUNTIME=1 + $Env:ONNX_ML=1 + $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" + python setup.py bdist_wheel + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' displayName: 'Install ONNX' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index 0b95b7909d3db..dc3af8ef992f1 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -51,7 +51,7 @@ then dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib -elif [[ $LIB_NAME == *.so.* ]] +elif [[ $LIB_NAME == *.so ]] then cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.so cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.so From ed4d83bb0eb2f80b6f80e2b9bc9102bd115d7782 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 19 May 2020 09:42:02 -0700 Subject: [PATCH 36/88] Add version setting. --- .../java-api-packaging-pipelines-gpu.yml | 18 ++++++------------ .../java-api-packaging-pipelines.yml | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index e28d4ceaa5671..d818143d42973 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -112,44 +112,38 @@ jobs: - Linux_Java_API_Build_GPU_x64 condition: succeeded() steps: - + - template: templates/set-version-number-variables-step.yml - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Win x64' inputs: - artifactName: 'drop-onnxruntime-java-win-x64-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-win-x64-gpu-$(OnnxRuntimeVersion)' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Linux x64' inputs: - artifactName: 'drop-onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-win-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64-gpu' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-linux-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64-gpu' cleanDestinationFolder: true - task: CmdLine@2 inputs: script: | - pushd linux-x64 + pushd linux-x64-gpu jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd - pushd osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM - popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final GPU Jar' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index e6223a1f89016..7e2cebae75f46 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -156,7 +156,7 @@ jobs: - MacOS_Java_API_Build_CPU_x64 condition: succeeded() steps: - + - template: templates/set-version-number-variables-step.yml - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Win x64' inputs: From c3b34924b4b808aac367777de6eb8e5dc91c9244 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 19 May 2020 09:46:06 -0700 Subject: [PATCH 37/88] Autoremove bsolte packages. --- tools/ci_build/github/linux/java_copy_strip_binary.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index dc3af8ef992f1..6225f15a78af1 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -21,6 +21,7 @@ uname -a # CentOS docker image does not have Java and we need jar here if [ `uname -s` == 'Linux' ]; then sudo apt-get install -y openjdk-8-jdk + sudo apt autoremove PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} fi From 353493efc250f0b296632b9c7a5772e3ed3f3dc0 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 19 May 2020 10:53:38 -0700 Subject: [PATCH 38/88] Fix Windows build command line. Add sudo to docker commands. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 6 +++--- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index d818143d42973..2c18acb92a64b 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -9,12 +9,12 @@ jobs: - task: CmdLine@2 inputs: script: | - docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu . + sudo docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu . workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker - task: CmdLine@2 inputs: script: | - docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 + sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6-gpu /usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_java --build_shared_lib --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --use_cuda --cuda_version=10.1 --cuda_home=/usr/local/cuda-10.1 --cudnn_home=/usr/local/cuda-10.1 workingDirectory: $(Build.SourcesDirectory) - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml parameters: @@ -92,7 +92,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: --config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)'' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 7e2cebae75f46..4e81c65049f50 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -11,13 +11,13 @@ jobs: - task: CmdLine@2 inputs: script: | - docker build --pull -t onnxruntime-centos6 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=3.6 -f Dockerfile.centos6 . + sudo docker build --pull -t onnxruntime-centos6 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=3.6 -f Dockerfile.centos6 . workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker displayName: 'Build CentoOS6 docker image' - task: CmdLine@2 inputs: script: | - docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /bin/bash -c "/usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --build_java --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --enable_onnx_tests && cd /build/Release && make install DESTDIR=/build/linux-x64" + sudo docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-centos6 /bin/bash -c "/usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_shared_lib --build_java --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --enable_onnx_tests && cd /build/Release && make install DESTDIR=/build/linux-x64" workingDirectory: $(Build.SourcesDirectory) displayName: 'Run build and test' From 6f89cf1ae5f6a94c0f00a3c3d94ddbea1345148e Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 19 May 2020 10:56:38 -0700 Subject: [PATCH 39/88] Fix a ' --- .../github/azure-pipelines/java-api-packaging-pipelines-gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 2c18acb92a64b..9cf6ae086de59 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -92,7 +92,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)'' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml From db831ed109033ff7289a669bf6a733536bee7a23 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 19 May 2020 16:00:39 -0700 Subject: [PATCH 40/88] Remove version from artifact name. --- .../java-api-packaging-pipelines-gpu.yml | 9 +++++---- .../java-api-packaging-pipelines.yml | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 9cf6ae086de59..6d7b12cd29a05 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -20,7 +20,7 @@ jobs: parameters: arch: 'linux-x64' buildConfig: 'Release' - artifactName: 'onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' + artifactName: 'onnxruntime-java-linux-x64-gpu' version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' @@ -98,7 +98,7 @@ jobs: - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml parameters: buildConfig: RelWithDebInfo - artifactName: 'onnxruntime-java-win-$(buildArch)-gpu-$(OnnxRuntimeVersion)' + artifactName: 'onnxruntime-java-win-$(buildArch)-gpu' version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml @@ -113,16 +113,17 @@ jobs: condition: succeeded() steps: - template: templates/set-version-number-variables-step.yml + - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Win x64' inputs: - artifactName: 'drop-onnxruntime-java-win-x64-gpu-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-win-x64-gpu' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Linux x64' inputs: - artifactName: 'drop-onnxruntime-java-linux-x64-gpu-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-linux-x64-gpu' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: ExtractFiles@1 diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 4e81c65049f50..ab91a84a67228 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -25,7 +25,7 @@ jobs: parameters: arch: 'linux-x64' buildConfig: 'Release' - artifactName: 'onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' + artifactName: 'onnxruntime-java-linux-x64' version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' @@ -51,7 +51,7 @@ jobs: parameters: arch: 'osx-x64' buildConfig: 'RelWithDebInfo' - artifactName: 'onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' + artifactName: 'onnxruntime-java-osx-x64' version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.dylib' nativeLibraryName: 'libonnxruntime4j_jni.dylib' @@ -141,7 +141,7 @@ jobs: - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml parameters: buildConfig: RelWithDebInfo - artifactName: 'onnxruntime-java-win-$(buildArch)-$(OnnxRuntimeVersion)' + artifactName: 'onnxruntime-java-win-$(buildArch)' version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) - template: templates/clean-agent-build-directory-step.yml @@ -157,22 +157,23 @@ jobs: condition: succeeded() steps: - template: templates/set-version-number-variables-step.yml + - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Win x64' inputs: - artifactName: 'drop-onnxruntime-java-win-x64-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-win-x64' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - Linux x64' inputs: - artifactName: 'drop-onnxruntime-java-linux-x64-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-linux-x64' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - MacOS x64' inputs: - artifactName: 'drop-onnxruntime-java-osx-x64-$(OnnxRuntimeVersion)' + artifactName: 'drop-onnxruntime-java-osx-x64' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: ExtractFiles@1 From 884e097063134494d0241d2510ee4e9a0f192ada Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 10:53:40 -0700 Subject: [PATCH 41/88] Replace install_dps url. Fix up cleaning steps. Add --enable_wcos --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 5 +++-- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 6 ++++-- .../ci_build/github/linux/docker/scripts/install_centos.sh | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 6d7b12cd29a05..60c907f8a0b01 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -72,7 +72,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --enable_wcos --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -92,7 +92,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --enable_wcos --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -101,6 +101,7 @@ jobs: artifactName: 'onnxruntime-java-win-$(buildArch)-gpu' version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index ab91a84a67228..a48b9669e55db 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -29,6 +29,7 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' + - template: templates/clean-agent-build-directory-step.yml - job: MacOS_Java_API_Build_CPU_x64 workspace: @@ -114,7 +115,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --enable_wcos --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -135,7 +136,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --enable_wcos--use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -144,6 +145,7 @@ jobs: artifactName: 'onnxruntime-java-win-$(buildArch)' version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging diff --git a/tools/ci_build/github/linux/docker/scripts/install_centos.sh b/tools/ci_build/github/linux/docker/scripts/install_centos.sh index 5d38d35d418b1..dcf45f8500c79 100755 --- a/tools/ci_build/github/linux/docker/scripts/install_centos.sh +++ b/tools/ci_build/github/linux/docker/scripts/install_centos.sh @@ -16,7 +16,7 @@ elif [ "$os_major_version" == "6" ] && [ ! -d "/opt/python/cp35-cp35m" ]; then #The base image we are using already contains devtoolset-2 yum install -y redhat-lsb-core expat-devel libcurl-devel tar unzip curl zlib-devel make libunwind icu aria2 rsync bzip2 git bzip2-devel #Install python 3.6 - yum install -y https://centos6.iuscommunity.org/ius-release.rpm + yum install -y https://repo.ius.io/ius-release-el6.rpm yum --enablerepo=ius install -y python36u python36u-devel python36u-pip python36u-numpy python36u-setuptools python36u-wheel /usr/bin/python3.6 -m pip install --upgrade pip else From 661bd2207aaa21ce474d5731385dd27a70de1bd0 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 11:27:05 -0700 Subject: [PATCH 42/88] Add component governance. --- .../java-api-packaging-pipelines-gpu.yml | 4 ++++ .../azure-pipelines/java-api-packaging-pipelines.yml | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 60c907f8a0b01..4be09c152e4f9 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -24,6 +24,10 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' + - template: ../../templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - template: templates/clean-agent-build-directory-step.yml - job: Windows_Java_API_Build_GPU_x64 diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index a48b9669e55db..c72da343b9ea1 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -29,6 +29,11 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' + + - template: ../../templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - template: templates/clean-agent-build-directory-step.yml - job: MacOS_Java_API_Build_CPU_x64 @@ -56,6 +61,11 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.dylib' nativeLibraryName: 'libonnxruntime4j_jni.dylib' + + - template: ../../templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - template: templates/clean-agent-build-directory-step.yml - job: Windows_Java_API_Build_CPU_x64 From 9f70f97e6bc6026b1c674e33ab8a2f60cb68d66f Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 11:28:49 -0700 Subject: [PATCH 43/88] Fix component gov path. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 2 +- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 4be09c152e4f9..7a2141987ef63 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -24,7 +24,7 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' - - template: ../../templates/component-governance-component-detection-steps.yml + - template: templates/component-governance-component-detection-steps.yml parameters : condition : 'succeeded' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index c72da343b9ea1..385739b41fcde 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -30,7 +30,7 @@ jobs: libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' - - template: ../../templates/component-governance-component-detection-steps.yml + - template: templates/component-governance-component-detection-steps.yml parameters : condition : 'succeeded' @@ -62,7 +62,7 @@ jobs: libraryName: 'libonnxruntime.dylib' nativeLibraryName: 'libonnxruntime4j_jni.dylib' - - template: ../../templates/component-governance-component-detection-steps.yml + - template: templates/component-governance-component-detection-steps.yml parameters : condition : 'succeeded' From 5967d2ba1b7e5e694be42a7ae56923d4c4e6257f Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 12:09:08 -0700 Subject: [PATCH 44/88] Fix build switches, add generating testing.jar --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 8 ++++---- .../azure-pipelines/java-api-packaging-pipelines.yml | 4 ++-- ...va-api-artifacts-package-and-publish-steps-windows.yml | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 7a2141987ef63..a881abc0c3039 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -76,7 +76,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --enable_wcos --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --enable_wcos --build_java --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -96,7 +96,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --enable_wcos --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_wcos --build_java --test --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -147,8 +147,8 @@ jobs: inputs: script: | pushd linux-x64-gpu - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final GPU Jar' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 385739b41fcde..833f77d0bc18d 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -125,7 +125,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --enable_wcos --build_java --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_wcos --build_java --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -146,7 +146,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --enable_lto --build_java --enable_wcos--use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_java --build_shared_lib --enable_wcos --build_java --test --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index d1c73662ad379..dceda719bc3ed 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -28,6 +28,12 @@ steps: jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\onnxruntime-${{parameters.version}}.jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\onnxruntime-${{parameters.version}}.jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID popd + pushd $(Build.SourcesDirectory)\java\build\classes\java\test + jar cf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . + popd + pushd $(Build.SourcesDirectory)\java\build\resources\test + jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . + popd rd /s /q $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage dir /s /b $(Build.BinariesDirectory)\${{parameters.artifactName}} workingDirectory: '$(Build.BinariesDirectory)\${{parameters.buildConfig}}' From c420890202f2aa3f1f25afc3323053ad7129cc56 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 13:08:58 -0700 Subject: [PATCH 45/88] Remove --enable_wcos from CUDA. Currently not working. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index a881abc0c3039..8986f59f54926 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -76,7 +76,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --enable_wcos --build_java --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_java --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' @@ -96,7 +96,7 @@ jobs: displayName: 'test' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_wcos --build_java --test --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' + arguments: '--config RelWithDebInfo --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --build_java --test --cmake_generator "Visual Studio 16 2019" --enable_lto --use_openmp --build_shared_lib --enable_onnx_tests $(buildparameter)' workingDirectory: '$(Build.BinariesDirectory)' - template: templates/java-api-artifacts-package-and-publish-steps-windows.yml From e5c11fb0bf3cacc2b4ba55973efee09b0ebd15fe Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 14:01:37 -0700 Subject: [PATCH 46/88] Replace DownloadPipelineArtifact to @2 --- .../azure-pipelines/java-api-packaging-pipelines.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 833f77d0bc18d..b8182a72dbe4f 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -170,21 +170,24 @@ jobs: steps: - template: templates/set-version-number-variables-step.yml - - task: DownloadPipelineArtifact@0 + - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Win x64' inputs: + buildType: 'current' artifactName: 'drop-onnxruntime-java-win-x64' targetPath: '$(Build.BinariesDirectory)/java-artifact' - - task: DownloadPipelineArtifact@0 + - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Linux x64' inputs: + buildType: 'current' artifactName: 'drop-onnxruntime-java-linux-x64' targetPath: '$(Build.BinariesDirectory)/java-artifact' - - task: DownloadPipelineArtifact@0 + - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - MacOS x64' inputs: + buildType: 'current' artifactName: 'drop-onnxruntime-java-osx-x64' targetPath: '$(Build.BinariesDirectory)/java-artifact' From ae6d5bbd4d1ab2cdc6745865c1221d92ddb938b9 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 20 May 2020 14:05:05 -0700 Subject: [PATCH 47/88] Update download artifact version. Fix paths. --- .../java-api-packaging-pipelines-gpu.yml | 10 ++++++---- .../azure-pipelines/java-api-packaging-pipelines.yml | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 8986f59f54926..c8f9d4b650739 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -119,27 +119,29 @@ jobs: steps: - template: templates/set-version-number-variables-step.yml - - task: DownloadPipelineArtifact@0 + - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Win x64' inputs: + buildType: 'current' artifactName: 'drop-onnxruntime-java-win-x64-gpu' targetPath: '$(Build.BinariesDirectory)/java-artifact' - - task: DownloadPipelineArtifact@0 + - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Linux x64' inputs: + buildType: 'current' artifactName: 'drop-onnxruntime-java-linux-x64-gpu' targetPath: '$(Build.BinariesDirectory)/java-artifact' - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-win-x64.zip' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64-gpu' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-linux-x64.zip' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64-gpu' cleanDestinationFolder: true diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index b8182a72dbe4f..d1939cbe0a6f1 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -193,19 +193,19 @@ jobs: - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-win-x64.zip' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-linux-x64.zip' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/nuget-artifact/onnxruntime-java-osx-x64.zip' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-osx-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact/osx-x64' cleanDestinationFolder: true From af3e6b1ae9404f799d1103cfb9d88eb2393f2118 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 10:49:28 -0700 Subject: [PATCH 48/88] Fix up artifacts names. Add end to end testing. --- .../java-api-packaging-pipelines-gpu.yml | 24 ++++-- .../java-api-packaging-pipelines.yml | 32 +++++--- .../templates/java-test-final-jar-step.yml | 82 +++++++++++++++++++ 3 files changed, 118 insertions(+), 20 deletions(-) create mode 100644 tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index c8f9d4b650739..3423501e3a607 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -135,28 +135,36 @@ jobs: - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64-gpu' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64-gpu.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64-gpu' + archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64-gpu.zip' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact/' cleanDestinationFolder: true - task: CmdLine@2 inputs: script: | - pushd linux-x64-gpu - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + pushd onnxruntime-java-linux-x64-gpu + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final GPU Jar' - task: PublishPipelineArtifact@1 inputs: - targetPath: '$(Build.BinariesDirectory)\java-artifact\win-x64' + targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu' artifact: 'onnxruntime-java-gpu' publishLocation: 'pipeline' + + - template templates/java-test-final-jar-step.yml + parameters: + WindowsPool : 'Win-GPU-2019' + LinuxPool : 'Linux-GPU-CUDA10' + version : '$(OnnxRuntimeVersion)' + RunMacOs : 'false' + artifactName: 'onnxruntime-java-gpu' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index d1939cbe0a6f1..774c9f5250a42 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -194,41 +194,49 @@ jobs: - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/win-x64' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/linux-x64' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-osx-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/osx-x64' + destinationFolder: '$(Build.BinariesDirectory)/java-artifact' cleanDestinationFolder: true - task: CmdLine@2 inputs: script: | - pushd linux-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + pushd onnxruntime-java-linux-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so popd - pushd osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM + pushd onnxruntime-java-osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final Jar' - task: PublishPipelineArtifact@1 inputs: - targetPath: '$(Build.BinariesDirectory)\java-artifact\win-x64' + targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64' artifact: 'onnxruntime-java' publishLocation: 'pipeline' + - template templates/java-test-final-jar-step.yml + parameters: + WindowsPool : 'Win-CPU-2019' + LinuxPool : 'Linux-CPU' + version : '$(OnnxRuntimeVersion)' + RunMacOs : 'true' + artifactName: 'onnxruntime-java' + diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml new file mode 100644 index 0000000000000..6b0f22961b00d --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -0,0 +1,82 @@ +parameters: + WindowsPool : 'Win-CPU-2019' + LinuxPool : 'Linux-CPU' + version : '' + RunMacOs : 'false' + artifactName: '' + +jobs: +- job: Test_Final_Jar_Linux + timeoutInMinutes: 60 + pool: ${{parameters.LinuxPool}} + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: ${{parameters.artifactName}} + targetPath: '$(Build.BinariesDirectory)/final-jar' + + - task: CmdLine@2 + inputs: + script: | + sudo apt-get install -y openjdk-8-jdk + sudo apt autoremove + PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' + +- job: Test_Final_Jar_MacOs + parameters: + timeoutInMinutes: 60 + pool: + vmImage: 'macOS-10.14' + condition: eq(parameters['RunMacOs'], 'true') + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: ${{parameters.artifactName}} + targetPath: '$(Build.BinariesDirectory)/final-jar' + + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' + +- job: Test_Final_Jar_Windows + timeoutInMinutes: 60 + pool: ${{parameters.WindowsPool}} + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: ${{parameters.artifactName}} + targetPath: '$(Build.BinariesDirectory)\final-jar' + + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)\final-jar\testing.jar + popd + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" + java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)\final-jar' From b88a29fab77f25899bf192d4a795a8e2421e2fd5 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 10:53:16 -0700 Subject: [PATCH 49/88] Fix up template invocation. --- .../java-api-packaging-pipelines-gpu.yml | 10 +++++----- .../azure-pipelines/java-api-packaging-pipelines.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 3423501e3a607..10757a20c1442 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -161,10 +161,10 @@ jobs: artifact: 'onnxruntime-java-gpu' publishLocation: 'pipeline' - - template templates/java-test-final-jar-step.yml + - template: templates/java-test-final-jar-step.yml parameters: - WindowsPool : 'Win-GPU-2019' - LinuxPool : 'Linux-GPU-CUDA10' - version : '$(OnnxRuntimeVersion)' - RunMacOs : 'false' + WindowsPool: 'Win-GPU-2019' + LinuxPool: 'Linux-GPU-CUDA10' + version: '$(OnnxRuntimeVersion)' + RunMacOs: 'false' artifactName: 'onnxruntime-java-gpu' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 774c9f5250a42..4a3717a241996 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -232,11 +232,11 @@ jobs: artifact: 'onnxruntime-java' publishLocation: 'pipeline' - - template templates/java-test-final-jar-step.yml + - template: templates/java-test-final-jar-step.yml parameters: - WindowsPool : 'Win-CPU-2019' - LinuxPool : 'Linux-CPU' - version : '$(OnnxRuntimeVersion)' - RunMacOs : 'true' + WindowsPool: 'Win-CPU-2019' + LinuxPool: 'Linux-CPU' + version: '$(OnnxRuntimeVersion)' + RunMacOs: 'true' artifactName: 'onnxruntime-java' From cbdae46679301ba21215d6f31c3f85f234057874 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 10:54:35 -0700 Subject: [PATCH 50/88] Remove stray jobs. --- .../azure-pipelines/templates/java-test-final-jar-step.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml index 6b0f22961b00d..9682753f29704 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -5,7 +5,6 @@ parameters: RunMacOs : 'false' artifactName: '' -jobs: - job: Test_Final_Jar_Linux timeoutInMinutes: 60 pool: ${{parameters.LinuxPool}} From b7b2f4d8a11a84c62a6919f0664387cddada17c8 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 10:56:30 -0700 Subject: [PATCH 51/88] Fix parameters --- .../azure-pipelines/templates/java-test-final-jar-step.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml index 9682753f29704..4f101348ebbdd 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -6,7 +6,8 @@ parameters: artifactName: '' - job: Test_Final_Jar_Linux - timeoutInMinutes: 60 + parameters: + timeoutInMinutes: 60 pool: ${{parameters.LinuxPool}} - task: DownloadPipelineArtifact@2 @@ -58,7 +59,8 @@ parameters: workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Test_Final_Jar_Windows - timeoutInMinutes: 60 + parameters: + timeoutInMinutes: 60 pool: ${{parameters.WindowsPool}} - task: DownloadPipelineArtifact@2 From 9e00f6778bd41b9bf62f88e7b43619dca288567c Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 10:59:46 -0700 Subject: [PATCH 52/88] Add steps. --- .../templates/java-test-final-jar-step.yml | 123 +++++++++--------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml index 4f101348ebbdd..cb184c5579317 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -6,78 +6,75 @@ parameters: artifactName: '' - job: Test_Final_Jar_Linux - parameters: - timeoutInMinutes: 60 + timeoutInMinutes: 60 pool: ${{parameters.LinuxPool}} + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: ${{parameters.artifactName}} + targetPath: '$(Build.BinariesDirectory)/final-jar' - - task: DownloadPipelineArtifact@2 - displayName: 'Download Final Jar' - inputs: - buildType: 'current' - artifactName: ${{parameters.artifactName}} - targetPath: '$(Build.BinariesDirectory)/final-jar' - - - task: CmdLine@2 - inputs: - script: | - sudo apt-get install -y openjdk-8-jdk - sudo apt autoremove - PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} - mkdir test - pushd test - jar xf $(Build.BinariesDirectory)/final-jar/testing.jar - popd - wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ - wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ - java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner - workingDirectory: '$(Build.BinariesDirectory)/final-jar' + - task: CmdLine@2 + inputs: + script: | + sudo apt-get install -y openjdk-8-jdk + sudo apt autoremove + PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Test_Final_Jar_MacOs - parameters: - timeoutInMinutes: 60 + timeoutInMinutes: 60 pool: vmImage: 'macOS-10.14' condition: eq(parameters['RunMacOs'], 'true') + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: ${{parameters.artifactName}} + targetPath: '$(Build.BinariesDirectory)/final-jar' - - task: DownloadPipelineArtifact@2 - displayName: 'Download Final Jar' - inputs: - buildType: 'current' - artifactName: ${{parameters.artifactName}} - targetPath: '$(Build.BinariesDirectory)/final-jar' - - - task: CmdLine@2 - inputs: - script: | - mkdir test - pushd test - jar xf $(Build.BinariesDirectory)/final-jar/testing.jar - popd - wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ - wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ - java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner - workingDirectory: '$(Build.BinariesDirectory)/final-jar' + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Test_Final_Jar_Windows - parameters: - timeoutInMinutes: 60 + timeoutInMinutes: 60 pool: ${{parameters.WindowsPool}} + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: ${{parameters.artifactName}} + targetPath: '$(Build.BinariesDirectory)\final-jar' - - task: DownloadPipelineArtifact@2 - displayName: 'Download Final Jar' - inputs: - buildType: 'current' - artifactName: ${{parameters.artifactName}} - targetPath: '$(Build.BinariesDirectory)\final-jar' - - - task: CmdLine@2 - inputs: - script: | - mkdir test - pushd test - jar xf $(Build.BinariesDirectory)\final-jar\testing.jar - popd - powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" - powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" - java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner - workingDirectory: '$(Build.BinariesDirectory)\final-jar' + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)\final-jar\testing.jar + popd + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" + java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-${{parameters.version}}.jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)\final-jar' From 187511eb582d91f097c5eefd42dfa6c39b499f08 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 11:02:31 -0700 Subject: [PATCH 53/88] Add quotes --- .../azure-pipelines/templates/java-test-final-jar-step.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml index cb184c5579317..115e4c07ee534 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -7,7 +7,7 @@ parameters: - job: Test_Final_Jar_Linux timeoutInMinutes: 60 - pool: ${{parameters.LinuxPool}} + pool: '${{parameters.LinuxPool}}' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download Final Jar' @@ -57,8 +57,8 @@ parameters: workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Test_Final_Jar_Windows - timeoutInMinutes: 60 - pool: ${{parameters.WindowsPool}} + timeoutInMinutes: 60 + pool: '${{parameters.WindowsPool}}' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download Final Jar' From 5cb5540c5a44a63a5a115598f489b4e5d7bc10fa Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 11:44:35 -0700 Subject: [PATCH 54/88] Add quotes. --- .../azure-pipelines/templates/java-test-final-jar-step.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml index 115e4c07ee534..fe29471d66684 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -13,7 +13,7 @@ parameters: displayName: 'Download Final Jar' inputs: buildType: 'current' - artifactName: ${{parameters.artifactName}} + artifactName: '${{parameters.artifactName}}' targetPath: '$(Build.BinariesDirectory)/final-jar' - task: CmdLine@2 @@ -41,7 +41,7 @@ parameters: displayName: 'Download Final Jar' inputs: buildType: 'current' - artifactName: ${{parameters.artifactName}} + artifactName: '${{parameters.artifactName}}' targetPath: '$(Build.BinariesDirectory)/final-jar' - task: CmdLine@2 @@ -64,7 +64,7 @@ parameters: displayName: 'Download Final Jar' inputs: buildType: 'current' - artifactName: ${{parameters.artifactName}} + artifactName: '${{parameters.artifactName}}' targetPath: '$(Build.BinariesDirectory)\final-jar' - task: CmdLine@2 From 080c6c3117868dadc273cfd67d872540990a9bd3 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 11:47:32 -0700 Subject: [PATCH 55/88] Remove spaces. --- .../templates/java-test-final-jar-step.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml index fe29471d66684..17be34a1c6d12 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -1,8 +1,8 @@ parameters: - WindowsPool : 'Win-CPU-2019' - LinuxPool : 'Linux-CPU' - version : '' - RunMacOs : 'false' + WindowsPool: 'Win-CPU-2019' + LinuxPool: 'Linux-CPU' + version: '' + RunMacOs: 'false' artifactName: '' - job: Test_Final_Jar_Linux From ec202d52f551d8264d6d7d15c235357059916d9d Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 12:09:58 -0700 Subject: [PATCH 56/88] Inject the testing task directly into the pipeline --- .../java-api-packaging-pipelines.yml | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 4a3717a241996..f40bcfcc94a6d 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -232,11 +232,33 @@ jobs: artifact: 'onnxruntime-java' publishLocation: 'pipeline' - - template: templates/java-test-final-jar-step.yml - parameters: - WindowsPool: 'Win-CPU-2019' - LinuxPool: 'Linux-CPU' - version: '$(OnnxRuntimeVersion)' - RunMacOs: 'true' - artifactName: 'onnxruntime-java' +- job: Final_Jar_Testing + workspace: + clean: all + pool: 'Win-CPU-2019' + timeoutInMinutes: 60 + dependsOn: + Jar_Packaging + steps: + - template: templates/set-version-number-variables-step.yml + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: 'onnxruntime-java' + targetPath: '$(Build.BinariesDirectory)\final-jar' + + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)\final-jar\testing.jar + popd + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" + java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)\final-jar' + From 2f924cbda852d70b7fd0d62af3b5f750818c8706 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 12:22:59 -0700 Subject: [PATCH 57/88] Inject Finak Jar testing tasks directly into CPU pipeline --- .../java-api-packaging-pipelines.yml | 64 ++++++++++++++++++- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index f40bcfcc94a6d..2b8e0793d936a 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -208,7 +208,6 @@ jobs: archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-osx-x64.zip' destinationFolder: '$(Build.BinariesDirectory)/java-artifact' cleanDestinationFolder: true - - task: CmdLine@2 inputs: @@ -224,7 +223,6 @@ jobs: jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' - displayName: 'Create final Jar' - task: PublishPipelineArtifact@1 inputs: @@ -232,7 +230,7 @@ jobs: artifact: 'onnxruntime-java' publishLocation: 'pipeline' -- job: Final_Jar_Testing +- job: Final_Jar_Testing_Windows workspace: clean: all pool: 'Win-CPU-2019' @@ -261,4 +259,64 @@ jobs: java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)\final-jar' +- job: Final_Jar_Testing_Linux + workspace: + clean: all + pool: 'Linux-CPU' + timeoutInMinutes: 60 + dependsOn: + Jar_Packaging + steps: + - template: templates/set-version-number-variables-step.yml + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: 'onnxruntime-java' + targetPath: '$(Build.BinariesDirectory)/final-jar' + + - task: CmdLine@2 + inputs: + script: | + sudo apt-get install -y openjdk-8-jdk + sudo apt autoremove + PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' + +- job: Final_Jar_Testing_MacOs + workspace: + clean: all + pool: + vmImage: 'macOS-10.14' + timeoutInMinutes: 60 + dependsOn: + Jar_Packaging + steps: + - template: templates/set-version-number-variables-step.yml + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: '${{parameters.artifactName}}' + targetPath: '$(Build.BinariesDirectory)/final-jar' + + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' From a220875f82e6e586bbc3a6d9e87891e28ca1275d Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 12:23:54 -0700 Subject: [PATCH 58/88] Fix up parameters --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 2b8e0793d936a..ff4258bb2389a 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -305,7 +305,7 @@ jobs: displayName: 'Download Final Jar' inputs: buildType: 'current' - artifactName: '${{parameters.artifactName}}' + artifactName: 'onnxruntime-java' targetPath: '$(Build.BinariesDirectory)/final-jar' - task: CmdLine@2 From 64e4a052be346cb19034a4b33316de89382e6154 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 12:26:28 -0700 Subject: [PATCH 59/88] Inject Final Jar testing jobs directly into a pipeline --- .../java-api-packaging-pipelines-gpu.yml | 64 +++++++++++++++++-- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 10757a20c1442..87a7e65a14907 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -161,10 +161,62 @@ jobs: artifact: 'onnxruntime-java-gpu' publishLocation: 'pipeline' - - template: templates/java-test-final-jar-step.yml - parameters: - WindowsPool: 'Win-GPU-2019' - LinuxPool: 'Linux-GPU-CUDA10' - version: '$(OnnxRuntimeVersion)' - RunMacOs: 'false' +- job: Final_Jar_Testing_Windows + workspace: + clean: all + pool: 'Win-GPU-2019' + timeoutInMinutes: 60 + dependsOn: + Jar_Packaging + steps: + - template: templates/set-version-number-variables-step.yml + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' + artifactName: 'onnxruntime-java-gpu' + targetPath: '$(Build.BinariesDirectory)\final-jar' + + - task: CmdLine@2 + inputs: + script: | + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)\final-jar\testing.jar + popd + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" + powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" + java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)\final-jar' + +- job: Final_Jar_Testing_Linux + workspace: + clean: all + pool: 'Linux-GPU-CUDA10' + timeoutInMinutes: 60 + dependsOn: + Jar_Packaging + steps: + - template: templates/set-version-number-variables-step.yml + - task: DownloadPipelineArtifact@2 + displayName: 'Download Final Jar' + inputs: + buildType: 'current' artifactName: 'onnxruntime-java-gpu' + targetPath: '$(Build.BinariesDirectory)/final-jar' + + - task: CmdLine@2 + inputs: + script: | + sudo apt-get install -y openjdk-8-jdk + sudo apt autoremove + PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} + mkdir test + pushd test + jar xf $(Build.BinariesDirectory)/final-jar/testing.jar + popd + wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ + wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + workingDirectory: '$(Build.BinariesDirectory)/final-jar' From 145ec63fdb84501dacb52c99fe271dd3b0da908e Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 13:22:48 -0700 Subject: [PATCH 60/88] Fix up slashes? --- .../java-api-packaging-pipelines-gpu.yml | 12 ++++++------ .../java-api-packaging-pipelines.yml | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 87a7e65a14907..ea0460474346f 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -124,25 +124,25 @@ jobs: inputs: buildType: 'current' artifactName: 'drop-onnxruntime-java-win-x64-gpu' - targetPath: '$(Build.BinariesDirectory)/java-artifact' + targetPath: '$(Build.BinariesDirectory)\java-artifact' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Linux x64' inputs: buildType: 'current' artifactName: 'drop-onnxruntime-java-linux-x64-gpu' - targetPath: '$(Build.BinariesDirectory)/java-artifact' + targetPath: '$(Build.BinariesDirectory)\java-artifact' - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64-gpu.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/' + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64-gpu.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact/' + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64-gpu.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' cleanDestinationFolder: true - task: CmdLine@2 diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index ff4258bb2389a..9a8d1fb3425c6 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -175,38 +175,38 @@ jobs: inputs: buildType: 'current' artifactName: 'drop-onnxruntime-java-win-x64' - targetPath: '$(Build.BinariesDirectory)/java-artifact' + targetPath: '$(Build.BinariesDirectory)\java-artifact' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - Linux x64' inputs: buildType: 'current' artifactName: 'drop-onnxruntime-java-linux-x64' - targetPath: '$(Build.BinariesDirectory)/java-artifact' + targetPath: '$(Build.BinariesDirectory)\java-artifact' - task: DownloadPipelineArtifact@2 displayName: 'Download Pipeline Artifact - MacOS x64' inputs: buildType: 'current' artifactName: 'drop-onnxruntime-java-osx-x64' - targetPath: '$(Build.BinariesDirectory)/java-artifact' + targetPath: '$(Build.BinariesDirectory)\java-artifact' - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-win-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact' + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-linux-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact' + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' cleanDestinationFolder: true - task: ExtractFiles@1 inputs: - archiveFilePatterns: '$(Build.BinariesDirectory)/java-artifact/onnxruntime-java-osx-x64.zip' - destinationFolder: '$(Build.BinariesDirectory)/java-artifact' + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-osx-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' cleanDestinationFolder: true - task: CmdLine@2 From e5b3cb542895f0947f859eac6011c87395725b7c Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 13:26:58 -0700 Subject: [PATCH 61/88] Remove clean step. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 6 ------ .../azure-pipelines/java-api-packaging-pipelines.yml | 8 -------- 2 files changed, 14 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index ea0460474346f..dd1ff47f798e3 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -109,8 +109,6 @@ jobs: - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging - workspace: - clean: all pool: 'Win-CPU-2019' dependsOn: - Windows_Java_API_Build_GPU_x64 @@ -162,8 +160,6 @@ jobs: publishLocation: 'pipeline' - job: Final_Jar_Testing_Windows - workspace: - clean: all pool: 'Win-GPU-2019' timeoutInMinutes: 60 dependsOn: @@ -191,8 +187,6 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)\final-jar' - job: Final_Jar_Testing_Linux - workspace: - clean: all pool: 'Linux-GPU-CUDA10' timeoutInMinutes: 60 dependsOn: diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 9a8d1fb3425c6..1620b6c27941a 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -159,8 +159,6 @@ jobs: - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging - workspace: - clean: all pool: 'Win-CPU-2019' dependsOn: - Windows_Java_API_Build_CPU_x64 @@ -231,8 +229,6 @@ jobs: publishLocation: 'pipeline' - job: Final_Jar_Testing_Windows - workspace: - clean: all pool: 'Win-CPU-2019' timeoutInMinutes: 60 dependsOn: @@ -260,8 +256,6 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)\final-jar' - job: Final_Jar_Testing_Linux - workspace: - clean: all pool: 'Linux-CPU' timeoutInMinutes: 60 dependsOn: @@ -291,8 +285,6 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Final_Jar_Testing_MacOs - workspace: - clean: all pool: vmImage: 'macOS-10.14' timeoutInMinutes: 60 From 88e92221f539481c93a8855986fecf121be869f0 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 13:40:08 -0700 Subject: [PATCH 62/88] Remove cleaning the artifacts folder as we download there. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 6 ++++-- .../azure-pipelines/java-api-packaging-pipelines.yml | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index dd1ff47f798e3..43b89f7475b60 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -109,6 +109,8 @@ jobs: - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging + workspace: + clean: all pool: 'Win-CPU-2019' dependsOn: - Windows_Java_API_Build_GPU_x64 @@ -135,13 +137,13 @@ jobs: inputs: archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu.zip' destinationFolder: '$(Build.BinariesDirectory)\java-artifact' - cleanDestinationFolder: true + cleanDestinationFolder: false - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64-gpu.zip' destinationFolder: '$(Build.BinariesDirectory)\java-artifact' - cleanDestinationFolder: true + cleanDestinationFolder: false - task: CmdLine@2 inputs: diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 1620b6c27941a..dc6058c467cad 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -159,6 +159,8 @@ jobs: - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging + workspace: + clean: all pool: 'Win-CPU-2019' dependsOn: - Windows_Java_API_Build_CPU_x64 @@ -193,19 +195,19 @@ jobs: inputs: archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64.zip' destinationFolder: '$(Build.BinariesDirectory)\java-artifact' - cleanDestinationFolder: true + cleanDestinationFolder: false - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64.zip' destinationFolder: '$(Build.BinariesDirectory)\java-artifact' - cleanDestinationFolder: true + cleanDestinationFolder: false - task: ExtractFiles@1 inputs: archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-osx-x64.zip' destinationFolder: '$(Build.BinariesDirectory)\java-artifact' - cleanDestinationFolder: true + cleanDestinationFolder: false - task: CmdLine@2 inputs: From 83aa14ac853962fb465c37f89f6fd6f5c601bfa5 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 14:26:33 -0700 Subject: [PATCH 63/88] Adjust paths. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 3 +-- .../azure-pipelines/java-api-packaging-pipelines.yml | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 43b89f7475b60..8e0a363c71666 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -149,8 +149,7 @@ jobs: inputs: script: | pushd onnxruntime-java-linux-x64-gpu - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar . popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final GPU Jar' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index dc6058c467cad..e840556c05bc3 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -213,14 +213,10 @@ jobs: inputs: script: | pushd onnxruntime-java-linux-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.so - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.so + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar . popd pushd onnxruntime-java-osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dlib - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime.dylib.dSYM - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\libonnxruntime4j_jni.dylib.dSYM + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar . popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' From 350d179c3b7df32a0abde8d95f8bb6baa1e8c1f1 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 15:27:59 -0700 Subject: [PATCH 64/88] Fix unix testing. --- .../java-api-packaging-pipelines-gpu.yml | 12 +++++++++++- .../azure-pipelines/java-api-packaging-pipelines.yml | 12 ++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 8e0a363c71666..276fe8329321d 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -24,6 +24,7 @@ jobs: version: '$(OnnxRuntimeVersion)' libraryName: 'libonnxruntime.so' nativeLibraryName: 'libonnxruntime4j_jni.so' + - template: templates/component-governance-component-detection-steps.yml parameters : condition : 'succeeded' @@ -106,6 +107,10 @@ jobs: version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging @@ -160,6 +165,11 @@ jobs: artifact: 'onnxruntime-java-gpu' publishLocation: 'pipeline' + - template: templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + + - job: Final_Jar_Testing_Windows pool: 'Win-GPU-2019' timeoutInMinutes: 60 @@ -213,5 +223,5 @@ jobs: popd wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ - java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)/final-jar' diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index e840556c05bc3..ebdc0b7d0cd93 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -156,6 +156,10 @@ jobs: version: '$(OnnxRuntimeVersion)' commitId: $(OnnxRuntimeGitCommitHash) + - template: templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - template: templates/clean-agent-build-directory-step.yml - job: Jar_Packaging @@ -226,6 +230,10 @@ jobs: artifact: 'onnxruntime-java' publishLocation: 'pipeline' + - template: templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - job: Final_Jar_Testing_Windows pool: 'Win-CPU-2019' timeoutInMinutes: 60 @@ -279,7 +287,7 @@ jobs: popd wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ - java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Final_Jar_Testing_MacOs @@ -307,6 +315,6 @@ jobs: popd wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ - java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .;./test;./protobuf-java-3.9.2.jar;./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)/final-jar' From 52775f5e19a0ea7402e77e0869fe0ece3a016df8 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 21 May 2020 17:04:14 -0700 Subject: [PATCH 65/88] Restore openjdk --- tools/ci_build/github/linux/docker/scripts/install_centos.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_build/github/linux/docker/scripts/install_centos.sh b/tools/ci_build/github/linux/docker/scripts/install_centos.sh index 34858b79e8622..f7c33e294ce9b 100755 --- a/tools/ci_build/github/linux/docker/scripts/install_centos.sh +++ b/tools/ci_build/github/linux/docker/scripts/install_centos.sh @@ -31,6 +31,7 @@ else fi fi +yum install -y java-1.8.0-openjdk-devel #If the /opt/python folder exists, we assume this is the manylinux docker image if [ "$os_major_version" != "6" ] && [ ! -d "/opt/python/cp35-cp35m" ] From e0d957bce2b3578ee4e3e6f087a526d9a0d7ccc0 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 26 May 2020 11:25:23 -0700 Subject: [PATCH 66/88] Add custom lib for testing to testing.jar. Copy binaries from the build folder, do not install java. --- .../java-api-packaging-pipelines.yml | 4 ++ .../github/linux/java_copy_strip_binary.sh | 37 +++++++------------ 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index ebdc0b7d0cd93..c179455c5f499 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -217,9 +217,13 @@ jobs: inputs: script: | pushd onnxruntime-java-linux-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar custom_op_library.so + del /F /Q custom_op_library.so jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar . popd pushd onnxruntime-java-osx-x64 + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar custom_op_library.dylib + del /F /Q custom_op_library.dylib jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar . popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index 6225f15a78af1..8368d99b454cc 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -18,44 +18,33 @@ EXIT_CODE=1 uname -a -# CentOS docker image does not have Java and we need jar here -if [ `uname -s` == 'Linux' ]; then - sudo apt-get install -y openjdk-8-jdk - sudo apt autoremove - PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} -fi - echo "Version: $VERSION_NUMBER" NATIVE_FOLDER=ai/onnxruntime/native/$ARCH mkdir -p $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER -mkdir $BINARY_DIR/$ARTIFACT_NAME/jar -echo "Directories created" -# We are only interested in one jar -# Extract to strip symbols -echo "Extract the original jar" -pushd $BINARY_DIR/$ARTIFACT_NAME/jar -jar xf $BINARY_DIR/$BUILD_CONFIG/java/build/libs/onnxruntime-$VERSION_NUMBER.jar -ls -laR -popd +echo "Directories created" echo "Copy debug symbols in a separate file and strip the original binary." if [[ $LIB_NAME == *.dylib ]] then # ORT LIB - dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME.dSYM - strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME - cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.dylib + dsymutil $BINARY_DIR/$BUILD_CONFIG/$LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$LIB_NAME.dSYM + cp $BINARY_DIR/$BUILD_CONFIG/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.dylib + strip -S $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.dylib # JNI Lib - dsymutil $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM - strip -S $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME - cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib + dsymutil $BINARY_DIR/$BUILD_CONFIG/$NATIVE_LIB_NAME -o $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/$NATIVE_LIB_NAME.dSYM + cp $BINARY_DIR/$BUILD_CONFIG/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib + strip -S $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib + # Add custom lib for testing. This should be added to testing.jar + cp $BINARY_DIR/$BUILD_CONFIG/custom_op_library.dylib $BINARY_DIR/$ARTIFACT_NAME elif [[ $LIB_NAME == *.so ]] then - cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.so - cp $BINARY_DIR/$ARTIFACT_NAME/jar/$NATIVE_FOLDER/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.so + cp $BINARY_DIR/$BUILD_CONFIG/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.so + cp $BINARY_DIR/$BUILD_CONFIG/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.so + # Add custom lib + cp $BINARY_DIR/$BUILD_CONFIG/custom_op_library.so $BINARY_DIR/$ARTIFACT_NAME fi find $BINARY_DIR/$ARTIFACT_NAME -ls From c4e937d6c15ade8e86d9eb47471c93cf977405ea Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 26 May 2020 12:54:13 -0700 Subject: [PATCH 67/88] Add lib prefix to the libs. --- .../azure-pipelines/java-api-packaging-pipelines.yml | 8 ++++---- tools/ci_build/github/linux/java_copy_strip_binary.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index c179455c5f499..673ac11b124b8 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -217,13 +217,13 @@ jobs: inputs: script: | pushd onnxruntime-java-linux-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar custom_op_library.so - del /F /Q custom_op_library.so + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.so + del /F /Q libcustom_op_library.so jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar . popd pushd onnxruntime-java-osx-x64 - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar custom_op_library.dylib - del /F /Q custom_op_library.dylib + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.dylib + del /F /Q libcustom_op_library.dylib jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\onnxruntime-$(OnnxRuntimeVersion).jar . popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh index 8368d99b454cc..568a11bf96c8e 100644 --- a/tools/ci_build/github/linux/java_copy_strip_binary.sh +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -38,13 +38,13 @@ then cp $BINARY_DIR/$BUILD_CONFIG/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib strip -S $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.dylib # Add custom lib for testing. This should be added to testing.jar - cp $BINARY_DIR/$BUILD_CONFIG/custom_op_library.dylib $BINARY_DIR/$ARTIFACT_NAME + cp $BINARY_DIR/$BUILD_CONFIG/libcustom_op_library.dylib $BINARY_DIR/$ARTIFACT_NAME elif [[ $LIB_NAME == *.so ]] then cp $BINARY_DIR/$BUILD_CONFIG/$LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime.so cp $BINARY_DIR/$BUILD_CONFIG/$NATIVE_LIB_NAME $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER/libonnxruntime4j_jni.so # Add custom lib - cp $BINARY_DIR/$BUILD_CONFIG/custom_op_library.so $BINARY_DIR/$ARTIFACT_NAME + cp $BINARY_DIR/$BUILD_CONFIG/libcustom_op_library.so $BINARY_DIR/$ARTIFACT_NAME fi find $BINARY_DIR/$ARTIFACT_NAME -ls From 103a03fcaeb12638d35453a74e392f5b4cc00fdd Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 26 May 2020 14:17:45 -0700 Subject: [PATCH 68/88] Fix up GPU pipeline. Run final test on Linux under GPU docker. --- .../java-api-packaging-pipelines-gpu.yml | 21 +++++++------- .../github/linux/java_linux_final_test.sh | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 tools/ci_build/github/linux/java_linux_final_test.sh diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 276fe8329321d..fc0e9fc1eaf80 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -154,6 +154,8 @@ jobs: inputs: script: | pushd onnxruntime-java-linux-x64-gpu + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.so + del /F /Q libcustom_op_library.so jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar . popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' @@ -214,14 +216,11 @@ jobs: - task: CmdLine@2 inputs: script: | - sudo apt-get install -y openjdk-8-jdk - sudo apt autoremove - PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} - mkdir test - pushd test - jar xf $(Build.BinariesDirectory)/final-jar/testing.jar - popd - wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ - wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ - java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner - workingDirectory: '$(Build.BinariesDirectory)/final-jar' + sudo docker build --pull -t onnxruntime-centos6-gpu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=$(python.version) -f Dockerfile.centos6_gpu . + workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker + + - task: CmdLine@2 + inputs: + script: | + sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src -volume $(Build.BinariesDirectory):/build -e NIGHTLY_BUILD onnxruntime-centos6-gpu /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -v $(OnnxRuntimeVersion) -r /build + workingDirectory: $(Build.BinariesDirectory)/final-jar diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh new file mode 100644 index 0000000000000..61f3e23f7ca1a --- /dev/null +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -e -o -x + +while getopts r:v: parameter_Option +do case "${parameter_Option}" +in +r) BINARY_DIR=${OPTARG};; +v) VERSION_NUMBER=${OPTARG};; +esac +done + +EXIT_CODE=1 + +uname -a + +mkdir test +echo "Directories created" +pushd test +jar xf $BINARY_DIR/final-jar/testing.jar +popd + +wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ +wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ +java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-${VERSION_NUMBER=}.jar --scan-class-path --fail-if-no-tests --disable-banner + +EXIT_CODE=$? + +set -e +exit $EXIT_CODE From ef510d75cb15e2b91eed109f65942de1efb1e21a Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 26 May 2020 14:19:10 -0700 Subject: [PATCH 69/88] Fix the indent --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index fc0e9fc1eaf80..096516a3f1b22 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -221,6 +221,6 @@ jobs: - task: CmdLine@2 inputs: - script: | - sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src -volume $(Build.BinariesDirectory):/build -e NIGHTLY_BUILD onnxruntime-centos6-gpu /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -v $(OnnxRuntimeVersion) -r /build - workingDirectory: $(Build.BinariesDirectory)/final-jar + script: | + sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src -volume $(Build.BinariesDirectory):/build -e NIGHTLY_BUILD onnxruntime-centos6-gpu /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -v $(OnnxRuntimeVersion) -r /build + workingDirectory: $(Build.BinariesDirectory)/final-jar From 3f3d8835fb7e84be10ec793740bf3691a0782544 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 26 May 2020 16:57:05 -0700 Subject: [PATCH 70/88] Adjust library paths for both CPU and GPU. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 3 ++- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 2 ++ tools/ci_build/github/linux/java_linux_final_test.sh | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 096516a3f1b22..1e0fa7ddd1315 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -196,6 +196,7 @@ jobs: popd powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" + PATH=.\test;"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin";C:\local\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin;%PATH% java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)\final-jar' @@ -222,5 +223,5 @@ jobs: - task: CmdLine@2 inputs: script: | - sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src -volume $(Build.BinariesDirectory):/build -e NIGHTLY_BUILD onnxruntime-centos6-gpu /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -v $(OnnxRuntimeVersion) -r /build + sudo docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build -e NIGHTLY_BUILD onnxruntime-centos6-gpu /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -v $(OnnxRuntimeVersion) -r /build workingDirectory: $(Build.BinariesDirectory)/final-jar diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 673ac11b124b8..d1f06fbfe40c7 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -291,6 +291,7 @@ jobs: popd wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + LD_LIBRARY_PATH=./test:${LD_LIBRARY_PATH} java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)/final-jar' @@ -319,6 +320,7 @@ jobs: popd wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ + DYLD_LIBRARY_PATH=./test:${DYLD_LIBRARY_PATH} java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)/final-jar' diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index 61f3e23f7ca1a..238bca9604972 100644 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -19,6 +19,7 @@ pushd test jar xf $BINARY_DIR/final-jar/testing.jar popd +echo "Library path:" $LD_LIBRARY_PATH wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-${VERSION_NUMBER=}.jar --scan-class-path --fail-if-no-tests --disable-banner From 6a60af70543ca7c50a1e0450b755fa512d9422f1 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 26 May 2020 17:57:26 -0700 Subject: [PATCH 71/88] Adjust library loading logic. --- java/src/test/java/ai/onnxruntime/InferenceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java index 99b2fd3c7c2c5..5a8856318a81d 100644 --- a/java/src/test/java/ai/onnxruntime/InferenceTest.java +++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException { // So we look it up as a classpath resource and resolve it to a real path customLibraryName = getResourcePath("/custom_op_library.dll").toString(); } else if (osName.contains("mac")) { - customLibraryName = "libcustom_op_library.dylib"; + customLibraryName = getResourcePath("/libcustom_op_library.dylib"); } else if (osName.contains("linux")) { - customLibraryName = "./libcustom_op_library.so"; + customLibraryName = getResourcePath("/libcustom_op_library.so"); } else { fail("Unknown os/platform '" + osName + "'"); } From ba279a9abb629c62e62538be17ef95d1e0ad50a3 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 09:26:38 -0700 Subject: [PATCH 72/88] Add toString() --- java/src/test/java/ai/onnxruntime/InferenceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java index 5a8856318a81d..bea793cddc512 100644 --- a/java/src/test/java/ai/onnxruntime/InferenceTest.java +++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException { // So we look it up as a classpath resource and resolve it to a real path customLibraryName = getResourcePath("/custom_op_library.dll").toString(); } else if (osName.contains("mac")) { - customLibraryName = getResourcePath("/libcustom_op_library.dylib"); + customLibraryName = getResourcePath("/libcustom_op_library.dylib").toString(); } else if (osName.contains("linux")) { - customLibraryName = getResourcePath("/libcustom_op_library.so"); + customLibraryName = getResourcePath("/libcustom_op_library.so").toString(); } else { fail("Unknown os/platform '" + osName + "'"); } From da26cb783373d38acb156e8dcb1a268888cb6208 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 10:15:55 -0700 Subject: [PATCH 73/88] Revert MacOS. Try Linux w/o ./ --- java/src/test/java/ai/onnxruntime/InferenceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java index bea793cddc512..9bb2f24dceff4 100644 --- a/java/src/test/java/ai/onnxruntime/InferenceTest.java +++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException { // So we look it up as a classpath resource and resolve it to a real path customLibraryName = getResourcePath("/custom_op_library.dll").toString(); } else if (osName.contains("mac")) { - customLibraryName = getResourcePath("/libcustom_op_library.dylib").toString(); + customLibraryName = getResourcePath("libcustom_op_library.dylib").toString(); } else if (osName.contains("linux")) { - customLibraryName = getResourcePath("/libcustom_op_library.so").toString(); + customLibraryName = getResourcePath("libcustom_op_library.so").toString(); } else { fail("Unknown os/platform '" + osName + "'"); } From 998822ac2b3c7d16790a6e15927ade4f8fd4b4da Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 10:20:45 -0700 Subject: [PATCH 74/88] Adjust library path. --- tools/ci_build/github/linux/java_linux_final_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index 238bca9604972..e60c44d108bea 100644 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -19,6 +19,7 @@ pushd test jar xf $BINARY_DIR/final-jar/testing.jar popd +LD_LIBRARY_PATH=./test:${LD_LIBRARY_PATH} echo "Library path:" $LD_LIBRARY_PATH wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ From 4480917d2cc2b1b4fc33de05476e1ab547816409 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 10:39:30 -0700 Subject: [PATCH 75/88] Remove loading as a resource. --- java/src/test/java/ai/onnxruntime/InferenceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java index 9bb2f24dceff4..bc0137abb1c1e 100644 --- a/java/src/test/java/ai/onnxruntime/InferenceTest.java +++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException { // So we look it up as a classpath resource and resolve it to a real path customLibraryName = getResourcePath("/custom_op_library.dll").toString(); } else if (osName.contains("mac")) { - customLibraryName = getResourcePath("libcustom_op_library.dylib").toString(); + customLibraryName = "libcustom_op_library.dylib"; } else if (osName.contains("linux")) { - customLibraryName = getResourcePath("libcustom_op_library.so").toString(); + customLibraryName = "libcustom_op_library.so"; } else { fail("Unknown os/platform '" + osName + "'"); } From a48dad56abcd8065ffd28c2f6b16835407f6c415 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 11:41:17 -0700 Subject: [PATCH 76/88] Load unix linraries as a resource. Create a symlink to custom_op lib just like on Windows so it is visible among the resource. --- cmake/onnxruntime_unittests.cmake | 13 +++++++++---- .../src/test/java/ai/onnxruntime/InferenceTest.java | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index d949310ed745d..01f38f206e44d 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -813,12 +813,15 @@ set_property(TARGET custom_op_library APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRU if (onnxruntime_BUILD_JAVA) message(STATUS "Running Java tests") + # native-test is added to resources so custom_op_lib can be loaded + # and we want to symlink it there + set(JAVA_NATIVE_TEST_DIR ${JAVA_OUTPUT_DIR}/native-test) + file(MAKE_DIRECTORY ${JAVA_NATIVE_TEST_DIR}) + # delegate to gradle's test runner if(WIN32) - # If we're on windows, symlink the custom op test library somewhere we can see it - set(JAVA_NATIVE_TEST_DIR ${JAVA_OUTPUT_DIR}/native-test) - file(MAKE_DIRECTORY ${JAVA_NATIVE_TEST_DIR}) - add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${JAVA_NATIVE_TEST_DIR}/$) + add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ + ${JAVA_NATIVE_TEST_DIR}/$) # On windows ctest requires a test to be an .exe(.com) file # So there are two options 1) Install Chocolatey and its gradle package # That package would install gradle.exe shim to its bin so ctest could run gradle.exe @@ -830,6 +833,8 @@ if (onnxruntime_BUILD_JAVA) -DREPO_ROOT=${REPO_ROOT} -P ${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime_java_unittests.cmake) else() + add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ + ${JAVA_NATIVE_TEST_DIR}/$) if (onnxruntime_USE_CUDA) add_test(NAME onnxruntime4j_test COMMAND ${GRADLE_EXECUTABLE} cmakeCheck -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} -DUSE_CUDA=1 WORKING_DIRECTORY ${REPO_ROOT}/java) diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java index bc0137abb1c1e..9bb2f24dceff4 100644 --- a/java/src/test/java/ai/onnxruntime/InferenceTest.java +++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException { // So we look it up as a classpath resource and resolve it to a real path customLibraryName = getResourcePath("/custom_op_library.dll").toString(); } else if (osName.contains("mac")) { - customLibraryName = "libcustom_op_library.dylib"; + customLibraryName = getResourcePath("libcustom_op_library.dylib").toString(); } else if (osName.contains("linux")) { - customLibraryName = "libcustom_op_library.so"; + customLibraryName = getResourcePath("libcustom_op_library.so").toString(); } else { fail("Unknown os/platform '" + osName + "'"); } From 01c423359620ea382f960758986f812b49518d03 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 12:11:05 -0700 Subject: [PATCH 77/88] Add leading underscore to resouce libs. --- java/src/test/java/ai/onnxruntime/InferenceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java index 9bb2f24dceff4..bea793cddc512 100644 --- a/java/src/test/java/ai/onnxruntime/InferenceTest.java +++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java @@ -907,9 +907,9 @@ public void testLoadCustomLibrary() throws OrtException { // So we look it up as a classpath resource and resolve it to a real path customLibraryName = getResourcePath("/custom_op_library.dll").toString(); } else if (osName.contains("mac")) { - customLibraryName = getResourcePath("libcustom_op_library.dylib").toString(); + customLibraryName = getResourcePath("/libcustom_op_library.dylib").toString(); } else if (osName.contains("linux")) { - customLibraryName = getResourcePath("libcustom_op_library.so").toString(); + customLibraryName = getResourcePath("/libcustom_op_library.so").toString(); } else { fail("Unknown os/platform '" + osName + "'"); } From b5de20d924c1c2b6e69dbf1299c4e184b40a2556 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 14:59:40 -0700 Subject: [PATCH 78/88] Adjust packaging tools. --- .../java-api-packaging-pipelines-gpu.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 1e0fa7ddd1315..298efb9b6015c 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -154,10 +154,16 @@ jobs: inputs: script: | pushd onnxruntime-java-linux-x64-gpu - jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64\testing.jar libcustom_op_library.so + jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\testing.jar libcustom_op_library.so del /F /Q libcustom_op_library.so jar uf $(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu\onnxruntime-$(OnnxRuntimeVersion).jar . popd + pushd onnxruntime-java-win-x64-gpu + ren onnxruntime-$(OnnxRuntimeVersion).jar onnxruntime-gpu-$(OnnxRuntimeVersion).jar + ren onnxruntime-$(OnnxRuntimeVersion)-javadoc.jar onnxruntime-gpu-$(OnnxRuntimeVersion)-javadoc.jar + ren onnxruntime-$(OnnxRuntimeVersion)-sources.jar onnxruntime-gpu-$(OnnxRuntimeVersion)-sources.jar + ren onnxruntime-$(OnnxRuntimeVersion).pom onnxruntime-gpu-$(OnnxRuntimeVersion).pom + popd workingDirectory: '$(Build.BinariesDirectory)\java-artifact' displayName: 'Create final GPU Jar' @@ -197,7 +203,7 @@ jobs: powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" PATH=.\test;"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin";C:\local\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin;%PATH% - java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-gpu-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)\final-jar' - job: Final_Jar_Testing_Linux From d82662d121d89463433ee44bca0a96b794df0e7f Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 15:07:33 -0700 Subject: [PATCH 79/88] Refer to gpu jar in the shall script. --- tools/ci_build/github/linux/java_linux_final_test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index e60c44d108bea..5e02669103899 100644 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -1,4 +1,6 @@ #!/bin/bash + +# This is for testing GPU final jar on Linux set -e -o -x while getopts r:v: parameter_Option @@ -23,7 +25,7 @@ LD_LIBRARY_PATH=./test:${LD_LIBRARY_PATH} echo "Library path:" $LD_LIBRARY_PATH wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ -java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-${VERSION_NUMBER=}.jar --scan-class-path --fail-if-no-tests --disable-banner +java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-gpu-${VERSION_NUMBER}.jar --scan-class-path --fail-if-no-tests --disable-banner EXIT_CODE=$? From 92775b576a973c9eb7d07feb997c82e94253389b Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 28 May 2020 00:39:56 +0000 Subject: [PATCH 80/88] Add executable permission for new scripts. --- tools/ci_build/github/linux/java_copy_strip_binary.sh | 0 tools/ci_build/github/linux/java_linux_final_test.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/ci_build/github/linux/java_copy_strip_binary.sh mode change 100644 => 100755 tools/ci_build/github/linux/java_linux_final_test.sh diff --git a/tools/ci_build/github/linux/java_copy_strip_binary.sh b/tools/ci_build/github/linux/java_copy_strip_binary.sh old mode 100644 new mode 100755 diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh old mode 100644 new mode 100755 From af54ceb1661542517125a5d437108e037f90cdd0 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 27 May 2020 18:01:40 -0700 Subject: [PATCH 81/88] Setup Cuda env variables. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 298efb9b6015c..1d379a230f9bd 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -193,6 +193,13 @@ jobs: artifactName: 'onnxruntime-java-gpu' targetPath: '$(Build.BinariesDirectory)\final-jar' + - task: BatchScript@1 + displayName: 'Setup CUDA Env' + inputs: + filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\setup_env_cuda.bat' + modifyEnvironment: true + workingFolder: '$(Build.BinariesDirectory)' + - task: CmdLine@2 inputs: script: | @@ -202,7 +209,6 @@ jobs: popd powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" - PATH=.\test;"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin";C:\local\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin;%PATH% java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-gpu-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)\final-jar' From 4ffa61ce01ae5bd20a0617ac9b400a550495f2ce Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 28 May 2020 11:38:50 -0700 Subject: [PATCH 82/88] Remove LD_LIBRARY_PATH manipulation. Add cleaning to all jobs. --- .../azure-pipelines/java-api-packaging-pipelines-gpu.yml | 4 ++++ .../github/azure-pipelines/java-api-packaging-pipelines.yml | 6 ++++++ tools/ci_build/github/linux/java_linux_final_test.sh | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index 1d379a230f9bd..e7f927edc4123 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -179,6 +179,8 @@ jobs: - job: Final_Jar_Testing_Windows + workspace: + clean: all pool: 'Win-GPU-2019' timeoutInMinutes: 60 dependsOn: @@ -213,6 +215,8 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)\final-jar' - job: Final_Jar_Testing_Linux + workspace: + clean: all pool: 'Linux-GPU-CUDA10' timeoutInMinutes: 60 dependsOn: diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index d1f06fbfe40c7..3a3b789d798be 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -239,6 +239,8 @@ jobs: condition : 'succeeded' - job: Final_Jar_Testing_Windows + workspace: + clean: all pool: 'Win-CPU-2019' timeoutInMinutes: 60 dependsOn: @@ -266,6 +268,8 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)\final-jar' - job: Final_Jar_Testing_Linux + workspace: + clean: all pool: 'Linux-CPU' timeoutInMinutes: 60 dependsOn: @@ -296,6 +300,8 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)/final-jar' - job: Final_Jar_Testing_MacOs + workspace: + clean: all pool: vmImage: 'macOS-10.14' timeoutInMinutes: 60 diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index 5e02669103899..a5c7d05f21462 100755 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -21,7 +21,6 @@ pushd test jar xf $BINARY_DIR/final-jar/testing.jar popd -LD_LIBRARY_PATH=./test:${LD_LIBRARY_PATH} echo "Library path:" $LD_LIBRARY_PATH wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ From 1c14c5407ef009ce4587ceac20f85f07470d10ed Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 28 May 2020 13:22:43 -0700 Subject: [PATCH 83/88] Remove native windows binaries from testing.jar --- .../java-api-artifacts-package-and-publish-steps-windows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index dceda719bc3ed..5a9c29e0bf3f4 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -29,10 +29,11 @@ steps: jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\onnxruntime-${{parameters.version}}.jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID popd pushd $(Build.SourcesDirectory)\java\build\classes\java\test - jar cf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . + jar cvf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . popd pushd $(Build.SourcesDirectory)\java\build\resources\test - jar uf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . + rd /s /q ai + jar uvf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . popd rd /s /q $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage dir /s /b $(Build.BinariesDirectory)\${{parameters.artifactName}} From ca6e88b05c41d0294f24ec6bf2eb704d73db4045 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 28 May 2020 13:28:31 -0700 Subject: [PATCH 84/88] Add Java version output. --- .../github/azure-pipelines/java-api-packaging-pipelines.yml | 4 ++++ .../java-api-artifacts-package-and-publish-steps-windows.yml | 2 ++ tools/ci_build/github/linux/java_linux_final_test.sh | 2 ++ 3 files changed, 8 insertions(+) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml index 3a3b789d798be..3cdc47ae3c55c 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -289,6 +289,8 @@ jobs: sudo apt-get install -y openjdk-8-jdk sudo apt autoremove PATH=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin:${PATH} + echo "Java Version" + java --version mkdir test pushd test jar xf $(Build.BinariesDirectory)/final-jar/testing.jar @@ -320,6 +322,8 @@ jobs: - task: CmdLine@2 inputs: script: | + echo "Java Version" + java --version mkdir test pushd test jar xf $(Build.BinariesDirectory)/final-jar/testing.jar diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 5a9c29e0bf3f4..116d6ec4f06cd 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -9,6 +9,8 @@ steps: - task: CmdLine@2 inputs: script: | + echo "Java version" + java --version set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ai\onnxruntime\native\win-x64 mkdir %NATIVE_FOLDER% echo "Directories created" diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index a5c7d05f21462..919bfd51ae8b5 100755 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -21,6 +21,8 @@ pushd test jar xf $BINARY_DIR/final-jar/testing.jar popd +java --version + echo "Library path:" $LD_LIBRARY_PATH wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ From 45dc7656b7ebf5aab7393c5c9ec446995c67a10e Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 28 May 2020 15:08:05 -0700 Subject: [PATCH 85/88] Fix native library removal. --- .../java-api-artifacts-package-and-publish-steps-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml index 116d6ec4f06cd..2911722528497 100644 --- a/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -34,7 +34,7 @@ steps: jar cvf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . popd pushd $(Build.SourcesDirectory)\java\build\resources\test - rd /s /q ai + rd /s /q ai\onnxruntime\native jar uvf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . popd rd /s /q $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage From 5aa003c646bc766d613cb1a34c7a2ca8a0495a94 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 28 May 2020 16:15:28 -0700 Subject: [PATCH 86/88] Make sure the current dir is what we need. --- tools/ci_build/github/linux/java_linux_final_test.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index 919bfd51ae8b5..c5e7e1115e06f 100755 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -15,15 +15,17 @@ EXIT_CODE=1 uname -a +cd $BINARY_DIR/final-jar + mkdir test + echo "Directories created" +echo "Library path:" $LD_LIBRARY_PATH + pushd test jar xf $BINARY_DIR/final-jar/testing.jar popd -java --version - -echo "Library path:" $LD_LIBRARY_PATH wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-gpu-${VERSION_NUMBER}.jar --scan-class-path --fail-if-no-tests --disable-banner From 6d996f211aa997fc180b2aea114d841ddde04867 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 29 May 2020 09:25:55 -0700 Subject: [PATCH 87/88] Add -DUSE_CUDA=1 flat for gpu testing. --- .../github/azure-pipelines/java-api-packaging-pipelines-gpu.yml | 2 +- tools/ci_build/github/linux/java_linux_final_test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml index e7f927edc4123..d6b28a71df09c 100644 --- a/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -211,7 +211,7 @@ jobs: popd powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -OutFile junit-platform-console-standalone-1.6.2.jar" powershell -Command "Invoke-WebRequest https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -OutFile protobuf-java-3.9.2.jar" - java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-gpu-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner + java -DUSE_CUDA=1 -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.9.2.jar;onnxruntime-gpu-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner workingDirectory: '$(Build.BinariesDirectory)\final-jar' - job: Final_Jar_Testing_Linux diff --git a/tools/ci_build/github/linux/java_linux_final_test.sh b/tools/ci_build/github/linux/java_linux_final_test.sh index c5e7e1115e06f..c51394c1d38cb 100755 --- a/tools/ci_build/github/linux/java_linux_final_test.sh +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -28,7 +28,7 @@ popd wget https://oss.sonatype.org/service/local/repositories/releases/content/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar -P ./ wget https://oss.sonatype.org/service/local/repositories/google-releases/content/com/google/protobuf/protobuf-java/3.9.2/protobuf-java-3.9.2.jar -P ./ -java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-gpu-${VERSION_NUMBER}.jar --scan-class-path --fail-if-no-tests --disable-banner +java -DUSE_CUDA=1 -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.9.2.jar:./onnxruntime-gpu-${VERSION_NUMBER}.jar --scan-class-path --fail-if-no-tests --disable-banner EXIT_CODE=$? From f09031aa5dd9e19e8e69bac4fc51a382da996790 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 1 Jun 2020 10:50:02 -0700 Subject: [PATCH 88/88] Break the line so it is not too long for flake --- tools/nuget/generate_nuspec_for_native_nuget.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py index ae323fa482cd0..83a4f99b82f4e 100644 --- a/tools/nuget/generate_nuspec_for_native_nuget.py +++ b/tools/nuget/generate_nuspec_for_native_nuget.py @@ -184,7 +184,8 @@ def generate_files(list, args): # Add custom operator headers files_list.append('') # Process runtimes