diff --git a/VERSION_NUMBER b/VERSION_NUMBER index f0bb29e763888..3a3cd8cc8b079 100644 --- a/VERSION_NUMBER +++ b/VERSION_NUMBER @@ -1 +1 @@ -1.3.0 +1.3.1 diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5db7fbc4c2692..ba8781fa4c32a 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) @@ -975,6 +977,11 @@ if (onnxruntime_BUILD_JAVA) include(onnxruntime_java.cmake) endif() +if (onnxruntime_BUILD_NODEJS) + message(STATUS "Node.js Build is enabled") + include(onnxruntime_nodejs.cmake) +endif() + # some of the tests rely on the shared libs to be # built; hence the ordering if (onnxruntime_BUILD_UNIT_TESTS) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 0c4338fc93413..0fffe6234cf53 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -42,6 +42,9 @@ set(GRADLE_ARGS clean jar) if(WIN32) set(GRADLE_ARGS ${GRADLE_ARGS} -Dorg.gradle.daemon=false) endif() +if(onnxruntime_USE_CUDA) + set(GRADLE_ARGS ${GRADLE_ARGS} -DUSE_CUDA=1) +endif() add_custom_command(OUTPUT ${JAVA_OUTPUT_JAR} COMMAND ${GRADLE_EXECUTABLE} ${GRADLE_ARGS} WORKING_DIRECTORY ${JAVA_ROOT} DEPENDS ${onnxruntime4j_gradle_files} ${onnxruntime4j_src}) add_custom_target(onnxruntime4j DEPENDS ${JAVA_OUTPUT_JAR}) set_source_files_properties(${JAVA_OUTPUT_JAR} PROPERTIES GENERATED TRUE) @@ -157,6 +160,9 @@ set(GRADLE_ARGS cmakeBuild -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR}) if(WIN32) set(GRADLE_ARGS ${GRADLE_ARGS} -Dorg.gradle.daemon=false) endif() +if(onnxruntime_USE_CUDA) + set(GRADLE_ARGS ${GRADLE_ARGS} -DUSE_CUDA=1) +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}) diff --git a/cmake/onnxruntime_java_unittests.cmake b/cmake/onnxruntime_java_unittests.cmake index 0986e4729819c..012121532bc4e 100644 --- a/cmake/onnxruntime_java_unittests.cmake +++ b/cmake/onnxruntime_java_unittests.cmake @@ -5,9 +5,15 @@ FILE(TO_NATIVE_PATH ${GRADLE_EXECUTABLE} GRADLE_NATIVE_PATH) FILE(TO_NATIVE_PATH ${BIN_DIR} BINDIR_NATIVE_PATH) -execute_process(COMMAND cmd /C ${GRADLE_NATIVE_PATH} cmakeCheck -DcmakeBuildDir=${BINDIR_NATIVE_PATH} -Dorg.gradle.daemon=false +if (onnxruntime_USE_CUDA) + execute_process(COMMAND cmd /C ${GRADLE_NATIVE_PATH} cmakeCheck -DcmakeBuildDir=${BINDIR_NATIVE_PATH} -Dorg.gradle.daemon=false -DUSE_CUDA=1 WORKING_DIRECTORY ${REPO_ROOT}/java RESULT_VARIABLE HAD_ERROR) +else() + execute_process(COMMAND cmd /C ${GRADLE_NATIVE_PATH} cmakeCheck -DcmakeBuildDir=${BINDIR_NATIVE_PATH} -Dorg.gradle.daemon=false + WORKING_DIRECTORY ${REPO_ROOT}/java + RESULT_VARIABLE HAD_ERROR) +endif() if(HAD_ERROR) message(FATAL_ERROR "Java Unitests failed") diff --git a/cmake/onnxruntime_nodejs.cmake b/cmake/onnxruntime_nodejs.cmake new file mode 100644 index 0000000000000..1fcb4127b5021 --- /dev/null +++ b/cmake/onnxruntime_nodejs.cmake @@ -0,0 +1,36 @@ +# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# Licensed under the MIT License. + +set(NODEJS_BINDING_ROOT ${REPO_ROOT}/nodejs) +if (WIN32) + set(NPM_CLI cmd /c npm) +else() + set(NPM_CLI npm) +endif() + +# verify Node.js and NPM +execute_process(COMMAND node --version + WORKING_DIRECTORY ${NODEJS_BINDING_ROOT} + OUTPUT_VARIABLE node_version + RESULT_VARIABLE had_error + OUTPUT_STRIP_TRAILING_WHITESPACE) +if(had_error) + message(FATAL_ERROR "Failed to find Node.js: " ${had_error}) +endif() +execute_process(COMMAND ${NPM_CLI} --version + WORKING_DIRECTORY ${NODEJS_BINDING_ROOT} + OUTPUT_VARIABLE npm_version + RESULT_VARIABLE had_error + OUTPUT_STRIP_TRAILING_WHITESPACE) +if(had_error) + message(FATAL_ERROR "Failed to find NPM: " ${had_error}) +endif() + +# add custom target +add_custom_target(nodejs_binding_wrapper ALL + COMMAND ${NPM_CLI} ci --ort-skip-build + COMMAND ${NPM_CLI} run build -- --onnxruntime-build-dir=${CMAKE_CURRENT_BINARY_DIR} --config=${CMAKE_BUILD_TYPE} + COMMAND ${NPM_CLI} test -- --timeout=10000 + WORKING_DIRECTORY ${NODEJS_BINDING_ROOT} + COMMENT "Using cmake-js to build OnnxRuntime Node.js binding") +add_dependencies(nodejs_binding_wrapper onnxruntime) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index b09d87dde7216..17a40bdd9d91d 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,8 +833,15 @@ if (onnxruntime_BUILD_JAVA) -DREPO_ROOT=${REPO_ROOT} -P ${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime_java_unittests.cmake) else() - add_test(NAME onnxruntime4j_test COMMAND ${GRADLE_EXECUTABLE} cmakeCheck -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} - WORKING_DIRECTORY ${REPO_ROOT}/java) + 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) + else() + add_test(NAME onnxruntime4j_test COMMAND ${GRADLE_EXECUTABLE} cmakeCheck -DcmakeBuildDir=${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ${REPO_ROOT}/java) + endif() endif() set_property(TEST onnxruntime4j_test APPEND PROPERTY DEPENDS onnxruntime4j_jni) endif() diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs index c634f235e5f8a..9f3092ba6493f 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs @@ -511,6 +511,7 @@ private static Dictionary GetSkippedModels() { "tf_resnet_v1_50", "result mismatch when Conv BN Fusion is applied" }, { "tf_resnet_v1_101", "result mismatch when Conv BN Fusion is applied" }, { "tf_resnet_v1_152", "result mismatch when Conv BN Fusion is applied" }, + { "coreml_Imputer-LogisticRegression_sklearn_load_breast_cancer", "Can't determine model file name" }, { "mask_rcnn_keras", "Model should be edited to remove the extra outputs" }, }; @@ -531,6 +532,7 @@ private static Dictionary GetSkippedModels() skipModels["tf_nasnet_large"] = "Get preallocated buffer for initializer ConvBnFusion_BN_B_cell_11/beginning_bn/beta:0_331 failed"; skipModels["test_zfnet512"] = "System out of memory"; skipModels["test_bvlc_reference_caffenet"] = "System out of memory"; + skipModels["coreml_VGG16_ImageNet"] = "System out of memory"; } return skipModels; @@ -1639,9 +1641,13 @@ private static void GetTypeAndWidth(TensorElementType elemType, out Type type, o } static NamedOnnxValue LoadTensorFromFilePb(string filename, IReadOnlyDictionary nodeMetaDict) { - var file = File.OpenRead(filename); - var tensor = Onnx.TensorProto.Parser.ParseFrom(file); - file.Close(); + //Set buffer size to 4MB + int readBufferSize = 4194304; + Onnx.TensorProto tensor = null; + using (var file = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read, readBufferSize)) + { + tensor = Onnx.TensorProto.Parser.ParseFrom(file); + } Type tensorElemType = null; int width = 0; diff --git a/docs/Versioning.md b/docs/Versioning.md index 87737dbd06649..af72de39e9fbc 100644 --- a/docs/Versioning.md +++ b/docs/Versioning.md @@ -26,7 +26,8 @@ For more details on ONNX Release versions, see [this page](https://github.com/on | ONNX Runtime release version | ONNX release version | ONNX opset version | ONNX ML opset version | Supported ONNX IR version | [WinML compatibility](https://docs.microsoft.com/en-us/windows/ai/windows-ml/)| |------------------------------|--------------------|--------------------|----------------------|------------------|------------------| -| 1.3.0 | **1.6** down to 1.2 | 11 | 2 | 6 | -- | +| 1.3.1 | **1.7** down to 1.2 | 12 | 2 | 6 | -- | +| 1.3.0 | **1.7** down to 1.2 | 12 | 2 | 6 | -- | | 1.2.0
1.1.2
1.1.1
1.1.0 | **1.6** down to 1.2 | 11 | 2 | 6 | -- | | 1.0.0 | **1.6** down to 1.2 | 11 | 2 | 6 | -- | | 0.5.0 | **1.5** down to 1.2 | 10 | 1 | 5 | -- | diff --git a/docs/python/README.rst b/docs/python/README.rst index 474d96993bcdc..e850a54633395 100644 --- a/docs/python/README.rst +++ b/docs/python/README.rst @@ -8,6 +8,11 @@ For more information on ONNX Runtime, please see `aka.ms/onnxruntime container = new HashMap<>(); + long[] inputShape = ((TensorInfo) inputMeta.getInfo()).shape; + Object tensor = OrtUtil.reshape(inputData, inputShape); + container.put(inputMeta.getName(), OnnxTensor.createTensor(env, tensor)); + try (OrtSession.Result result = session.run(container)) { + OnnxValue resultTensor = result.get(0); + float[] resultArray = TestHelpers.flattenFloat(resultTensor.getValue()); + assertEquals(expectedOutput.length, resultArray.length); + assertArrayEquals(expectedOutput, resultArray, 1e-6f); + } catch (OrtException e) { + throw new IllegalStateException("Failed to execute a scoring operation", e); + } + OnnxValue.close(container.values()); + } + } + } + private static File getTestModelsDir() throws IOException { // get build directory, append downloaded models location String cwd = System.getProperty("user.dir"); @@ -881,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 + "'"); } @@ -1399,7 +1425,7 @@ private static TypeWidth getTypeAndWidth(TensorProto.DataType elemType) { private static StringTensorPair loadTensorFromFilePb( OrtEnvironment env, File filename, Map nodeMetaDict) throws IOException, OrtException { - InputStream is = new BufferedInputStream(new FileInputStream(filename)); + InputStream is = new BufferedInputStream(new FileInputStream(filename), 1024 * 1024 * 4); OnnxMl.TensorProto tensor = OnnxMl.TensorProto.parseFrom(is); is.close(); diff --git a/nodejs/BUILD.md b/nodejs/BUILD.md deleted file mode 100644 index fbc6e29bb56e5..0000000000000 --- a/nodejs/BUILD.md +++ /dev/null @@ -1,55 +0,0 @@ -## Building Node.js binding - -### Pre-Requisites - -1. Node.js 12.x - -### Build Instructions - -Currently it takes 4 steps to build Node.js binding: - -1. Build ONNX Runtime with flag `--build_shared` in repo root. See [Build](../BUILD.md) for more info. - -2. In current folder, run `npm install`. This will pull dev dependencies. - -3. Run `npm run build` to build binding. - -4. Run `npm test` run tests. - -To consume the local built Node.js binding in a Node.js project: - -``` -npm install /nodejs -``` - -### Publish - -Publishing a NPM package with addon requires 2 steps: publish NPM package itself, and publish prebuild binaries. - -#### Publish NPM package - -To publish a release: - -``` -npm publish -``` - -To publish a @dev release: - -``` -npm publish --tag dev -``` - -To create a npm package (for local use or debug purpose): - -``` -npm pack -``` - -NOTE: Need to publish the package from a clean build, otherwise extra files may be packed. - -#### Publish prebuild binaries - -Currently, prebuild binaries only support 3 platforms on x64: win32/linux/macos. - -Prebuilds are currently uploaded manually. diff --git a/nodejs/CMakeLists.txt b/nodejs/CMakeLists.txt index ede8dcf4dfea8..e5d23f684078e 100644 --- a/nodejs/CMakeLists.txt +++ b/nodejs/CMakeLists.txt @@ -5,7 +5,6 @@ project (onnxruntime-node) set(CMAKE_CXX_STANDARD 14) add_compile_definitions(NAPI_VERSION=${napi_build_version}) -add_compile_definitions(NAPI_EXPERIMENTAL) # dist variables execute_process(COMMAND node -e "console.log(process.arch)" @@ -13,12 +12,24 @@ execute_process(COMMAND node -e "console.log(process.arch)" execute_process(COMMAND node -e "console.log(process.platform)" OUTPUT_VARIABLE node_platform OUTPUT_STRIP_TRAILING_WHITESPACE) file(READ ${CMAKE_SOURCE_DIR}/../VERSION_NUMBER ort_version) +string(STRIP "${ort_version}" ort_version) set(dist_folder "${CMAKE_SOURCE_DIR}/bin/napi-v3/${node_platform}/${node_arch}/") +# onnxruntime.dll dir +if(NOT ONNXRUNTIME_BUILD_DIR) + if (WIN32) + set(ONNXRUNTIME_BUILD_DIR ${CMAKE_SOURCE_DIR}/../build/Windows/${CMAKE_BUILD_TYPE}) + else() + set(ONNXRUNTIME_BUILD_DIR ${CMAKE_SOURCE_DIR}/../build/Linux) + endif() +endif() + +# include dirs include_directories(${CMAKE_JS_INC}) include_directories(${CMAKE_SOURCE_DIR}/../include/onnxruntime) include_directories(${CMAKE_SOURCE_DIR}/node_modules/node-addon-api) +# source files file(GLOB SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/*.cc) add_library(onnxruntime_binding SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) @@ -28,16 +39,20 @@ set_target_properties(onnxruntime_binding PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE) target_link_libraries(onnxruntime_binding PRIVATE ${CMAKE_JS_LIB}) +# add libraries +if (WIN32) + target_link_directories(onnxruntime_binding PRIVATE ${ONNXRUNTIME_BUILD_DIR}/${CMAKE_BUILD_TYPE}) +else() + target_link_directories(onnxruntime_binding PRIVATE ${ONNXRUNTIME_BUILD_DIR}) +endif() + if (WIN32) - target_link_libraries(onnxruntime_binding PRIVATE - ${CMAKE_SOURCE_DIR}/../build/Windows/${CMAKE_BUILD_TYPE}/${CMAKE_BUILD_TYPE}/onnxruntime.lib) + target_link_libraries(onnxruntime_binding PRIVATE onnxruntime.lib) elseif (APPLE) - target_link_libraries(onnxruntime_binding PRIVATE - ${CMAKE_SOURCE_DIR}/../build/Linux/${CMAKE_BUILD_TYPE}/libonnxruntime.${ort_version}.dylib) + target_link_libraries(onnxruntime_binding PRIVATE libonnxruntime.${ort_version}.dylib) set_target_properties(onnxruntime_binding PROPERTIES INSTALL_RPATH "@loader_path") else() - target_link_libraries(onnxruntime_binding PRIVATE - ${CMAKE_SOURCE_DIR}/../build/Linux/${CMAKE_BUILD_TYPE}/libonnxruntime.so.${ort_version}) + target_link_libraries(onnxruntime_binding PRIVATE libonnxruntime.so.${ort_version}) set_target_properties(onnxruntime_binding PROPERTIES INSTALL_RPATH "$ORIGIN/") endif() @@ -53,14 +68,14 @@ if (WIN32) add_custom_command( TARGET onnxruntime_binding POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/../build/Windows/${CMAKE_BUILD_TYPE}/${CMAKE_BUILD_TYPE}/onnxruntime.dll + ${ONNXRUNTIME_BUILD_DIR}/${CMAKE_BUILD_TYPE}/onnxruntime.dll ${dist_folder} ) if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_custom_command( TARGET onnxruntime_binding POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/../build/Windows/${CMAKE_BUILD_TYPE}/${CMAKE_BUILD_TYPE}/onnxruntime.pdb + ${ONNXRUNTIME_BUILD_DIR}/${CMAKE_BUILD_TYPE}/onnxruntime.pdb ${dist_folder} COMMAND ${CMAKE_COMMAND} -E copy $/onnxruntime_binding.pdb ${dist_folder} ) @@ -69,14 +84,14 @@ elseif (APPLE) add_custom_command( TARGET onnxruntime_binding POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/../build/Linux/${CMAKE_BUILD_TYPE}/libonnxruntime.${ort_version}.dylib + ${ONNXRUNTIME_BUILD_DIR}/libonnxruntime.${ort_version}.dylib ${dist_folder} ) elseif (UNIX) add_custom_command( TARGET onnxruntime_binding POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/../build/Linux/${CMAKE_BUILD_TYPE}/libonnxruntime.so.${ort_version} + ${ONNXRUNTIME_BUILD_DIR}/libonnxruntime.so.${ort_version} ${dist_folder} ) else() diff --git a/nodejs/README.md b/nodejs/README.md index e4a46b4fe3a0b..b5f08e6bdc17e 100644 --- a/nodejs/README.md +++ b/nodejs/README.md @@ -1,8 +1,8 @@ # ONNX Runtime Node.js API -This directory contains the Node.js binding for the ONNX runtime. +ONNX Runtime Node.js binding enables Node.js applications to run ONNX model inference. -## Installation +## Usage Install the latest stable version: @@ -16,20 +16,20 @@ Install the latest dev version: npm install onnxruntime@dev ``` -## Get Started +Refer to [Node.js samples](../samples/README.md#Nodejs) for samples and tutorials. -Refer to [examples](./examples/README.md) for usage and instructions. +## Requirements -## Supported Platforms +ONNXRuntime works on Node.js v12.x+ or Electron v5.x+. + +Following platforms are supported with pre-built binaries: - Windows x64 CPU NAPI_v3 - Linux x64 CPU NAPI_v3 - MacOS x64 CPU NAPI_v3 -## Building - -Refer to [BUILD](./BUILD.md) for instructions to build ONNX Runtime Node.js binding. +To use on platforms without pre-built binaries, you can build Node.js binding from source and consume it by `npm install /nodejs/`. See also [BUILD.MD](../BUILD.md#apis-and-language-bindings) for building ONNX Runtime Node.js binding locally. ## License -[MIT License](https://github.com/Microsoft/onnxruntime/blob/master/LICENSE) +License information can be found [here](../README.md#license). diff --git a/nodejs/examples/README.md b/nodejs/examples/README.md index 657992db5c405..65ad26b31a11f 100644 --- a/nodejs/examples/README.md +++ b/nodejs/examples/README.md @@ -4,11 +4,11 @@ This folder contains several examples that demonstrate how to use onnxruntime No ## Examples List -### [01 Basic Usage](./01_basic-usage/README.md) +### [01 Basic Usage](./01_basic-usage/) This example is a demonstration of basic usage of ONNX Runtime Node.js binding. -### [02 Create Tensor](./02_create-tensor/README.md) +### [02 Create Tensor](./02_create-tensor/) This example is a demonstration of basic usage of creating tensors. @@ -18,7 +18,7 @@ This example is a demonstration of basic usage of creating tensors. This example is a demonstration of advanced usage of creating tensors. --> -### [04 Create InferenceSession](./04_create-inference-session/README.md) +### [04 Create InferenceSession](./04_create-inference-session/) ## Usage diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index 234fd7545499f..b321daf32ecda 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -1,31 +1,31 @@ { "name": "onnxruntime", - "version": "0.0.1-dev.20200506.1", + "version": "1.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.1.tgz", + "integrity": "sha512-IGhtTmpjGbYzcEDOw7DcQtbQSXcG9ftmAXtWTu9V936vDye4xjjekktFAtgZsWpzTj/X01jocB46mTywm/4SZw==", "dev": true, "requires": { - "@babel/highlight": "^7.8.3" + "@babel/highlight": "^7.10.1" } }, "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz", + "integrity": "sha512-5vW/JXLALhczRCWP0PnFDMCJAchlBvM7f4uk/jXritBnIa6E1KmqmtrS3yn1LAnxFBypQ3eneLuXjsnfQsgILw==", "dev": true }, "@babel/highlight": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", - "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.1.tgz", + "integrity": "sha512-8rMof+gVP8mxYZApLF/JgNDAkdKa+aJt3ZYxF8z6+j/hpeXL7iMsKCPHa2jNMHu/qqBwzQF4OHNoYi8dMA/rYg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.9.0", + "@babel/helper-validator-identifier": "^7.10.1", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } @@ -161,9 +161,9 @@ "dev": true }, "@types/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-UoOfVEzAUpeSPmjm7h1uk5MH6KZma2z2O7a75onTGjnNvAvMVrPzPL/vBbT65iIGHWj6rokwfmYcmxmlSf2uwg==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.1.tgz", + "integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==", "dev": true, "requires": { "@types/node": "*" @@ -190,6 +190,12 @@ "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==", "dev": true }, + "@types/minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=", + "dev": true + }, "@types/mocha": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-7.0.2.tgz", @@ -197,9 +203,9 @@ "dev": true }, "@types/node": { - "version": "13.13.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.5.tgz", - "integrity": "sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==", + "version": "14.0.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.11.tgz", + "integrity": "sha512-lCvvI24L21ZVeIiyIUHZ5Oflv1hhHQ5E1S25IRlKIXaRkVgmXpJMI3wUJkmym2bTbCe+WoIibQnMVAU3FguaOg==", "dev": true }, "@types/tar-stream": { @@ -212,45 +218,45 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.31.0.tgz", - "integrity": "sha512-iIC0Pb8qDaoit+m80Ln/aaeu9zKQdOLF4SHcGLarSeY1gurW6aU4JsOPMjKQwXlw70MvWKZQc6S2NamA8SJ/gg==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", + "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.31.0", + "@typescript-eslint/experimental-utils": "2.34.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.31.0.tgz", - "integrity": "sha512-MI6IWkutLYQYTQgZ48IVnRXmLR/0Q6oAyJgiOror74arUMh7EWjJkADfirZhRsUMHeLJ85U2iySDwHTSnNi9vA==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.31.0", + "@typescript-eslint/typescript-estree": "2.34.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.31.0.tgz", - "integrity": "sha512-uph+w6xUOlyV2DLSC6o+fBDzZ5i7+3/TxAsH4h3eC64tlga57oMb96vVlXoMwjR/nN+xyWlsnxtbDkB46M2EPQ==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", + "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.31.0", - "@typescript-eslint/typescript-estree": "2.31.0", + "@typescript-eslint/experimental-utils": "2.34.0", + "@typescript-eslint/typescript-estree": "2.34.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz", - "integrity": "sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==", + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -258,22 +264,22 @@ "glob": "^7.1.6", "is-glob": "^4.0.1", "lodash": "^4.17.15", - "semver": "^6.3.0", + "semver": "^7.3.2", "tsutils": "^3.17.1" }, "dependencies": { "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true } } }, "acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", + "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", "dev": true }, "acorn-jsx": { @@ -452,9 +458,9 @@ "dev": true }, "aws4": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", - "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", + "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==", "dev": true }, "balanced-match": { @@ -799,9 +805,9 @@ "dev": true }, "comment-parser": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.4.tgz", - "integrity": "sha512-Nnl77/mt6sj1BiYSVMeMWzvD0183F2MFOJyFRmZHimUVDYS9J40AvXpiFA7RpU5pQH+HkvYc0dnsHpwW2xmbyQ==", + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.5.tgz", + "integrity": "sha512-iH9YA35ccw94nx5244GVkpyC9eVTsL71jZz6iz5w6RIf79JLF2AsXHXq9p6Oaohyl3sx5qSMnGsWUDFIAfWL4w==", "dev": true }, "concat-map": { @@ -1252,9 +1258,9 @@ "dev": true }, "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -1271,9 +1277,9 @@ } }, "eslint-visitor-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz", + "integrity": "sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ==", "dev": true }, "espree": { @@ -1413,9 +1419,9 @@ "dev": true }, "fastq": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.7.0.tgz", - "integrity": "sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -1517,9 +1523,9 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, "fs-extra": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.0.tgz", - "integrity": "sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", "dev": true, "requires": { "at-least-node": "^1.0.0", @@ -1669,9 +1675,9 @@ } }, "globby": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.0.tgz", - "integrity": "sha512-iuehFnR3xu5wBBtm4xi0dMe92Ob87ufyu/dHwpDYfbcpYpIbrO5OnS8M1vWvrBhSGEJ3/Ecj7gnX76P8YxpPEg==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", + "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -1683,9 +1689,9 @@ }, "dependencies": { "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true } } @@ -1764,9 +1770,9 @@ "dev": true }, "highlight.js": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.0.2.tgz", - "integrity": "sha512-2gMT2MHU6/2OjAlnaOE2LFdr9dwviDN3Q2lSw7Ois3/5uTtahbgYTkr4EPoY828ps+2eQWiixPTF8+phU6Ofkg==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.0.3.tgz", + "integrity": "sha512-9FG7SSzv9yOY5CGGxfI6NDm7xLYtMOjKtPBxw7Zff3t5UcRcUNTGEeS8lNjhceL34KeetLMoGMFTGoaa83HwyQ==", "dev": true }, "hosted-git-info": { @@ -1996,9 +2002,9 @@ } }, "interpret": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", - "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", "dev": true }, "invert-kv": { @@ -2029,9 +2035,9 @@ "dev": true }, "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", "dev": true }, "is-date-object": { @@ -2076,12 +2082,12 @@ "dev": true }, "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", + "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", "dev": true, "requires": { - "has": "^1.0.3" + "has-symbols": "^1.0.1" } }, "is-stream": { @@ -2135,9 +2141,9 @@ "dev": true }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -2394,9 +2400,9 @@ } }, "merge2": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", - "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, "micromatch": { @@ -2482,9 +2488,9 @@ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" }, "mocha": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz", - "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", + "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -2574,6 +2580,16 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -2716,17 +2732,17 @@ "dev": true }, "node-abi": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.16.0.tgz", - "integrity": "sha512-+sa0XNlWDA6T+bDLmkCUYn6W5k5W6BPRL6mqzSCs6H/xUgtl4D5x2fORKDzopKiU6wsyn/+wXlRXwXeSp+mtoA==", + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.18.0.tgz", + "integrity": "sha512-yi05ZoiuNNEbyT/xXfSySZE+yVnQW6fxPZuFbLyS1s6b5Kw3HzV2PHOM4XR+nsjzkHxByK+2Wg+yCQbe35l8dw==", "requires": { "semver": "^5.4.1" } }, "node-addon-api": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.0.tgz", - "integrity": "sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.0.tgz", + "integrity": "sha512-sSHCgWfJ+Lui/u+0msF3oyCgvdkhxDbkCS6Q8uiJquzOimkJBvX6hl5aSSA7DR1XbMpdM8r7phjcF63sF4rkKg==", "dev": true }, "node-environment-flags": { @@ -3035,14 +3051,14 @@ } }, "prebuild-install": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.3.tgz", - "integrity": "sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.4.tgz", + "integrity": "sha512-AkKN+pf4fSEihjapLEEj8n85YIw/tN6BQqkhzbDc0RvEZGdkpJBGMUYx66AAMcPG2KzmPQS7Cm16an4HVBRRMA==", "requires": { "detect-libc": "^1.0.3", "expand-template": "^2.0.3", "github-from-package": "0.0.0", - "minimist": "^1.2.0", + "minimist": "^1.2.3", "mkdirp": "^0.5.1", "napi-build-utils": "^1.0.1", "node-abi": "^2.7.0", @@ -3092,6 +3108,14 @@ "@types/long": "^4.0.1", "@types/node": "^13.7.0", "long": "^4.0.0" + }, + "dependencies": { + "@types/node": { + "version": "13.13.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.10.tgz", + "integrity": "sha512-J+FbkhLTcFstD7E5mVZDjYxa1VppwT2HALE6H3n2AnBSP8uiCQk0Pyr6BkJcP38dFV9WecoVJRJmFnl9ikIW7Q==", + "dev": true + } } }, "psl": { @@ -3192,9 +3216,9 @@ "dev": true }, "regextras": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.7.0.tgz", - "integrity": "sha512-ds+fL+Vhl918gbAUb0k2gVKbTZLsg84Re3DI6p85Et0U0tYME3hyW4nMK8Px4dtDaBA2qNjvG5uWyW7eK5gfmw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.7.1.tgz", + "integrity": "sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w==", "dev": true }, "request": { @@ -3403,9 +3427,9 @@ "dev": true }, "spdx-correct": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", - "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -3419,9 +3443,9 @@ "dev": true }, "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, "requires": { "spdx-exceptions": "^2.1.0", @@ -3625,9 +3649,9 @@ } }, "tar-fs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", - "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz", + "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==", "requires": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", @@ -3706,9 +3730,9 @@ "dev": true }, "tslib": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.2.tgz", - "integrity": "sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", "dev": true }, "tsutils": { @@ -3750,9 +3774,9 @@ "dev": true }, "typedoc": { - "version": "0.17.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.17.6.tgz", - "integrity": "sha512-pQiYnhG3yJk7939cv2n8uFoTsSgy5Hfiw0dgOQYa9nT9Ya1013dMctQdAXMj8JbNu7KhcauQyq9Zql9D/TziLw==", + "version": "0.17.7", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.17.7.tgz", + "integrity": "sha512-PEnzjwQAGjb0O8a6VDE0lxyLAadqNujN5LltsTUhZETolRMiIJv6Ox+Toa8h0XhKHqAOh8MOmB0eBVcWz6nuAw==", "dev": true, "requires": { "fs-extra": "^8.1.0", @@ -3790,15 +3814,15 @@ } }, "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz", + "integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==", "dev": true }, "uglify-js": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.2.tgz", - "integrity": "sha512-zGVwKslUAD/EeqOrD1nQaBmXIHl1Vw371we8cvS8I6mYK9rmgX5tv8AAeJdfsQ3Kk5mGax2SVV/AizxdNGhl7Q==", + "version": "3.9.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.4.tgz", + "integrity": "sha512-8RZBJq5smLOa7KslsNsVcSH+KOXf1uDU8yqLeNuVKwmT0T3FA0ZoXlinQfRad7SDcbZZRZE4ov+2v71EnxNyCA==", "dev": true, "optional": true, "requires": { @@ -3899,9 +3923,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", "dev": true }, "validate-npm-package-license": { @@ -4190,4 +4214,4 @@ } } } -} +} \ No newline at end of file diff --git a/nodejs/package.json b/nodejs/package.json index f234e42a9982e..dd2343898e0a1 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -1,15 +1,17 @@ { "name": "onnxruntime", "description": "Node.js binding of ONNXRuntime", - "version": "0.0.1-dev.20200506.1", + "version": "1.3.1", "main": "./lib/index.js", "types": "./types/lib/index.d.ts", "scripts": { "install": "prebuild-install -r napi || (tsc && node ./script/build)", "build": "tsc && node ./script/build", - "buildd": "tsc && node ./script/build --debug", + "buildd": "tsc && node ./script/build --config=Debug", + "buildr": "tsc && node ./script/build --config=RelWithDebInfo", "rebuild": "tsc && node ./script/build --rebuild", - "rebuildd": "tsc && node ./script/build --debug --rebuild", + "rebuildd": "tsc && node ./script/build --rebuild --config=Debug", + "rebuildr": "tsc && node ./script/build --rebuild --config=RelWithDebInfo", "test": "mocha ./test/test-main", "lint": "eslint . --ext .ts", "prepack": "node ./script/pack-prebuild", @@ -40,6 +42,7 @@ "devDependencies": { "@types/fs-extra": "^8.1.0", "@types/klaw-sync": "^6.0.0", + "@types/minimist": "1.2.0", "@types/mocha": "^7.0.2", "@types/tar-stream": "^2.1.0", "@typescript-eslint/eslint-plugin": "^2.29.0", @@ -54,8 +57,9 @@ "globby": "^11.0.0", "jsonc": "^2.0.0", "klaw-sync": "^6.0.0", + "minimist": "^1.2.5", "mocha": "^7.1.1", - "node-addon-api": "^2.0.0", + "node-addon-api": "^3.0.0", "node-pre-gyp-github": "^1.4.3", "onnx-proto": "^4.0.4", "tar-stream": "2.1.2", @@ -65,4 +69,4 @@ "dependencies": { "prebuild-install": "^5.3.3" } -} +} \ No newline at end of file diff --git a/nodejs/script/build.ts b/nodejs/script/build.ts index f716bbd2da227..f18136ed3ba46 100644 --- a/nodejs/script/build.ts +++ b/nodejs/script/build.ts @@ -1,14 +1,31 @@ import {execSync, spawnSync} from 'child_process'; import * as fs from 'fs-extra'; +import minimist from 'minimist'; import * as path from 'path'; +// NPM configs (parsed via 'npm install --xxx') + +// skip build on install. usually used in CI where build will be another step. +const SKIP = !!process.env.npm_config_ort_skip_build; +if (SKIP) { + process.exit(0); +} + // command line flags -const DEBUG = process.argv.slice(2).indexOf('--debug') !== -1; -const REBUILD = process.argv.slice(2).indexOf('--rebuild') !== -1; +const buildArgs = minimist(process.argv.slice(2)); + +// currently only support Debug, Release and RelWithDebInfo +const CONFIG: 'Debug'|'Release'|'RelWithDebInfo' = buildArgs.config || 'RelWithDebInfo'; +if (CONFIG !== 'Debug' && CONFIG !== 'Release' && CONFIG !== 'RelWithDebInfo') { + throw new Error(`unrecognized config: ${CONFIG}`); +} +const ONNXRUNTIME_BUILD_DIR = buildArgs['onnxruntime-build-dir']; +const REBUILD = !!buildArgs.rebuild; // build path const ROOT_FOLDER = path.join(__dirname, '..'); const BIN_FOLDER = path.join(ROOT_FOLDER, 'bin'); +const BUILD_FOLDER = path.join(ROOT_FOLDER, 'build'); const NPM_BIN_FOLDER = execSync('npm bin', {encoding: 'utf8'}).trim(); const CMAKE_JS_FULL_PATH = path.join(NPM_BIN_FOLDER, 'cmake-js'); @@ -16,19 +33,35 @@ const CMAKE_JS_FULL_PATH = path.join(NPM_BIN_FOLDER, 'cmake-js'); // if rebuild, clean up the dist folders if (REBUILD) { fs.removeSync(BIN_FOLDER); + fs.removeSync(BUILD_FOLDER); } const command = CMAKE_JS_FULL_PATH; -const args = [(REBUILD ? 'rebuild' : 'compile'), '--arch=x64', '--CDnapi_build_version=3']; -if (DEBUG) { - args.push('-D'); +const args = [ + (REBUILD ? 'reconfigure' : 'configure'), + '--arch=x64', + '--CDnapi_build_version=3', + `--CDCMAKE_BUILD_TYPE=${CONFIG}`, +]; +if (ONNXRUNTIME_BUILD_DIR && typeof ONNXRUNTIME_BUILD_DIR === 'string') { + args.push(`--CDONNXRUNTIME_BUILD_DIR=${ONNXRUNTIME_BUILD_DIR}`); +} + +// launch cmake-js configure +const procCmakejs = spawnSync(command, args, {shell: true, stdio: 'inherit', cwd: ROOT_FOLDER}); +if (procCmakejs.status !== 0) { + if (procCmakejs.error) { + console.error(procCmakejs.error); + } + process.exit(procCmakejs.status === null ? undefined : procCmakejs.status); } -// launch cmake-js -const proc = spawnSync(command, args, {shell: true, stdio: 'inherit', cwd: ROOT_FOLDER}); -if (proc.status !== 0) { - if (proc.error) { - console.error(proc.error); +// launch cmake to build +const procCmake = + spawnSync('cmake', ['--build', '.', '--config', CONFIG], {shell: true, stdio: 'inherit', cwd: BUILD_FOLDER}); +if (procCmake.status !== 0) { + if (procCmake.error) { + console.error(procCmake.error); } - process.exit(proc.status === null ? undefined : proc.status); + process.exit(procCmake.status === null ? undefined : procCmake.status); } diff --git a/nodejs/script/pack-prebuild.ts b/nodejs/script/pack-prebuild.ts index c5546e590eea9..5b0a0bf7af238 100644 --- a/nodejs/script/pack-prebuild.ts +++ b/nodejs/script/pack-prebuild.ts @@ -23,7 +23,7 @@ tarStream.pipe(zlib.createGzip({level: 9})).pipe(ws); // enumerate all files under BIN folder const entries = klawSync(BIN_FOLDER, {nodir: true}).map(i => ({ path: i.path, - name: path.relative(ROOT_FOLDER, i.path), + name: path.relative(ROOT_FOLDER, i.path).replace(/\\/g, '/'), size: i.stats.size, mode: i.stats.mode | parseInt('444', 8) | parseInt('222', 8), gid: i.stats.gid, diff --git a/nodejs/src/session_options_helper.cc b/nodejs/src/session_options_helper.cc index 8290ebf3dd60a..55825a4a2baac 100644 --- a/nodejs/src/session_options_helper.cc +++ b/nodejs/src/session_options_helper.cc @@ -4,6 +4,7 @@ #include "onnxruntime_cxx_api.h" #include +#include #include #include "common.h" diff --git a/nodejs/test/e2e/inference-session-run.ts b/nodejs/test/e2e/inference-session-run.ts index 2ce08e4112731..5ba57ef8d3961 100644 --- a/nodejs/test/e2e/inference-session-run.ts +++ b/nodejs/test/e2e/inference-session-run.ts @@ -22,5 +22,5 @@ describe('E2E Tests - InferenceSession.run()', async () => { const result = await session!.run({'data_0': input0}, ['softmaxout_1']); assertTensorEqual(result.softmaxout_1, expectedOutput0); } - }).timeout('60s'); + }).timeout('1200s'); }); diff --git a/onnxruntime/__init__.py b/onnxruntime/__init__.py index e7036ff2f465d..83be565d4af8b 100644 --- a/onnxruntime/__init__.py +++ b/onnxruntime/__init__.py @@ -6,7 +6,7 @@ ONNX Runtime is a performance-focused scoring engine for Open Neural Network Exchange (ONNX) models. For more information on ONNX Runtime, please see `aka.ms/onnxruntime `_ or the `Github project `_. """ -__version__ = "1.3.0" +__version__ = "1.3.1" __author__ = "Microsoft" from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, RunOptions, SessionOptions, set_default_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, ExecutionMode, OrtDevice, SessionIOBinding diff --git a/onnxruntime/core/graph/model.cc b/onnxruntime/core/graph/model.cc index f03e311168b92..24f45250ebb98 100644 --- a/onnxruntime/core/graph/model.cc +++ b/onnxruntime/core/graph/model.cc @@ -24,7 +24,9 @@ using namespace ONNX_NAMESPACE; using namespace onnxruntime; -using namespace ::onnxruntime::common; +using namespace onnxruntime::common; + +static constexpr int protobuf_block_size_in_bytes = 4 * 1024 * 1024; namespace onnxruntime { Model::Model(const std::string& graph_name, @@ -237,7 +239,7 @@ Status Model::Load(std::istream& model_istream, ModelProto* p_model_proto) { if (!p_model_proto) { return Status(ONNXRUNTIME, INVALID_ARGUMENT, "Null model_proto ptr."); } - google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream); + google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream, protobuf_block_size_in_bytes); const bool result = p_model_proto->ParseFromZeroCopyStream(&zero_copy_input) && model_istream.eof(); if (!result) { return Status(ONNXRUNTIME, INVALID_PROTOBUF, "Failed to load model because protobuf parsing failed."); @@ -447,7 +449,8 @@ Status Model::Load(int fd, ONNX_NAMESPACE::ModelProto& model_proto) { } #if GOOGLE_PROTOBUF_VERSION >= 3002000 - const bool result = model_proto.ParseFromFileDescriptor(fd); + FileInputStream input(fd, protobuf_block_size_in_bytes); + const bool result = model_proto.ParseFromZeroCopyStream(&input) && input.GetErrno() == 0; if (!result) { return Status(ONNXRUNTIME, INVALID_PROTOBUF, "Protobuf parsing failed."); } diff --git a/onnxruntime/core/providers/nuphar/kernel.h b/onnxruntime/core/providers/nuphar/kernel.h index 9119fe9e3294f..de57204d57cdf 100644 --- a/onnxruntime/core/providers/nuphar/kernel.h +++ b/onnxruntime/core/providers/nuphar/kernel.h @@ -76,10 +76,9 @@ class NupharKernelState { NUPHAR_OP(Abs, 6, DataTypeImpl::AllFixedSizeTensorTypes()) \ NUPHAR_OP(Add, 7, DataTypeImpl::AllFixedSizeTensorTypes()) \ NUPHAR_VERSIONED_OP(ArgMax, 1, 10, DataTypeImpl::AllFixedSizeTensorTypes()) \ - NUPHAR_OP(ArgMax, 11, DataTypeImpl::AllFixedSizeTensorTypes()) \ - NUPHAR_OP(ArgMax, 1, DataTypeImpl::AllFixedSizeTensorTypes()) \ + NUPHAR_VERSIONED_OP(ArgMax, 11, 11, DataTypeImpl::AllFixedSizeTensorTypes()) \ NUPHAR_VERSIONED_OP(ArgMin, 1, 10, DataTypeImpl::AllFixedSizeTensorTypes()) \ - NUPHAR_OP(ArgMin, 11, DataTypeImpl::AllFixedSizeTensorTypes()) \ + NUPHAR_VERSIONED_OP(ArgMin, 11, 11, DataTypeImpl::AllFixedSizeTensorTypes()) \ NUPHAR_VERSIONED_OP(AveragePool, 7, 9, DataTypeImpl::AllIEEEFloatTensorExceptHalfTypes()) \ NUPHAR_OP(AveragePool, 10, DataTypeImpl::AllIEEEFloatTensorExceptHalfTypes()) \ NUPHAR_OP(AveragePool, 11, DataTypeImpl::AllIEEEFloatTensorExceptHalfTypes()) \ diff --git a/onnxruntime/core/providers/nuphar/scripts/symbolic_shape_infer.py b/onnxruntime/core/providers/nuphar/scripts/symbolic_shape_infer.py index 5ef2ac4c2aa18..0db540c927e3b 100755 --- a/onnxruntime/core/providers/nuphar/scripts/symbolic_shape_infer.py +++ b/onnxruntime/core/providers/nuphar/scripts/symbolic_shape_infer.py @@ -1130,6 +1130,13 @@ def _infer_impl(self, in_mp, start_sympy_data={}): self._onnx_infer_single_node(node) if node.op_type in self.dispatcher_: self.dispatcher_[node.op_type](node) + elif node.op_type in ['ConvTranspose']: + # onnx shape inference ops like ConvTranspose may have empty shape for symbolic input + # before adding symbolic compute for them + # mark the output type as UNDEFINED to allow guessing of rank + vi = self.known_vi_[node.output[0]] + if len(vi.type.tensor_type.shape.dim) == 0: + vi.type.tensor_type.elem_type = onnx.TensorProto.UNDEFINED if self.verbose_ > 2: print(node.op_type + ': ' + node.name) @@ -1237,8 +1244,9 @@ def _update_output_from_vi(self): @staticmethod def infer_shapes(input_model, output_model, int_max=2**31 - 1, auto_merge=False, guess_output_rank=False, verbose=0): in_mp = onnx.load(input_model) - if get_opset(in_mp) < 7: - print('Only support models of opset 7 and above.') + onnx_opset = get_opset(in_mp) + if not onnx_opset or onnx_opset < 7: + print('Only support models of onnx opset 7 and above.') return symbolic_shape_inference = SymbolicShapeInference(int_max, auto_merge, guess_output_rank, verbose) all_shapes_inferred = False diff --git a/onnxruntime/test/onnx/main.cc b/onnxruntime/test/onnx/main.cc index 336a36da5ae31..cb37651baade6 100644 --- a/onnxruntime/test/onnx/main.cc +++ b/onnxruntime/test/onnx/main.cc @@ -434,7 +434,7 @@ int real_main(int argc, char* argv[], Ort::Env& env) { } #if !defined(__amd64__) && !defined(_M_AMD64) //out of memory - static const ORTCHAR_T* x86_disabled_tests[] = {ORT_TSTR("mlperf_ssd_resnet34_1200"), ORT_TSTR("mask_rcnn_keras"), ORT_TSTR("mask_rcnn"), ORT_TSTR("faster_rcnn"), ORT_TSTR("vgg19")}; + static const ORTCHAR_T* x86_disabled_tests[] = {ORT_TSTR("mlperf_ssd_resnet34_1200"), ORT_TSTR("mask_rcnn_keras"), ORT_TSTR("mask_rcnn"), ORT_TSTR("faster_rcnn"), ORT_TSTR("vgg19"), ORT_TSTR("coreml_VGG16_ImageNet")}; all_disabled_tests.insert(std::begin(x86_disabled_tests), std::end(x86_disabled_tests)); #endif diff --git a/package/rpm/onnxruntime.spec b/package/rpm/onnxruntime.spec index 8e24e6125db5b..ed7c8279ceec0 100644 --- a/package/rpm/onnxruntime.spec +++ b/package/rpm/onnxruntime.spec @@ -1,5 +1,5 @@ Name: onnxruntime -Version: 1.3.0 +Version: 1.3.1 Release: 1%{?dist} Summary: onnxruntime diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 412502969cb4e..4cf9d15c79d75 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -162,6 +162,11 @@ def parse_arguments(): parser.add_argument( "--build_java", action='store_true', help="Build Java bindings.") + # Node.js binding + parser.add_argument( + "--build_nodejs", action='store_true', + help="Build Node.js binding and NPM package.") + # Build a shared lib parser.add_argument( "--build_shared_lib", action='store_true', @@ -537,6 +542,7 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, "ON" if args.enable_pybind else "OFF"), "-Donnxruntime_BUILD_CSHARP=" + ("ON" if args.build_csharp else "OFF"), "-Donnxruntime_BUILD_JAVA=" + ("ON" if args.build_java else "OFF"), + "-Donnxruntime_BUILD_NODEJS=" + ("ON" if args.build_nodejs else "OFF"), "-Donnxruntime_BUILD_SHARED_LIB=" + ( "ON" if args.build_shared_lib else "OFF"), "-Donnxruntime_USE_EIGEN_FOR_BLAS=" + ( @@ -1515,7 +1521,7 @@ def main(): if args.build_wheel or args.gen_doc: args.enable_pybind = True - if args.build_csharp or args.build_java: + if args.build_csharp or args.build_java or args.build_nodejs: args.build_shared_lib = True # Disabling unit tests for VAD-F as FPGA only supports 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..c4803cad798e5 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines-gpu.yml @@ -0,0 +1,244 @@ +jobs: +- 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: | + 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 --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' + 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 + 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_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)' + + + - 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 --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 + parameters: + buildConfig: RelWithDebInfo + artifactName: 'onnxruntime-java-win-$(buildArch)-gpu' + 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 + workspace: + clean: all + pool: 'Win-CPU-2019' + dependsOn: + - Windows_Java_API_Build_GPU_x64 + - Linux_Java_API_Build_GPU_x64 + condition: succeeded() + steps: + - template: templates/set-version-number-variables-step.yml + + - 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@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)\java-artifact\onnxruntime-java-win-x64-gpu.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' + cleanDestinationFolder: false + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64-gpu.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' + cleanDestinationFolder: false + + - task: CmdLine@2 + inputs: + script: | + @echo on + pushd onnxruntime-java-linux-x64-gpu + 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' + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64-gpu' + artifact: 'onnxruntime-java-gpu' + publishLocation: 'pipeline' + + - template: templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + + +- 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: 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: | + 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 -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 + 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 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/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..84f6eb6ea7bc0 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/java-api-packaging-pipelines.yml @@ -0,0 +1,337 @@ +jobs: +- job: Linux_Java_API_Build_CPU_x64 + workspace: + clean: all + timeoutInMinutes: 60 + pool: 'Linux-CPU' + steps: + - template: templates/set-version-number-variables-step.yml + - template: templates/linux-set-variables-and-download.yml + + - task: CmdLine@2 + inputs: + script: | + 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: | + 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' + + - template: templates/java-api-artifacts-package-and-publish-steps-posix.yml + parameters: + arch: 'linux-x64' + buildConfig: 'Release' + artifactName: 'onnxruntime-java-linux-x64' + 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 + workspace: + clean: all + pool: + vmImage: 'macOS-10.14' + steps: + - 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 --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 + parameters: + arch: 'osx-x64' + buildConfig: 'RelWithDebInfo' + artifactName: 'onnxruntime-java-osx-x64' + 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 + 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 --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)' + + + - 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_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 + parameters: + buildConfig: RelWithDebInfo + artifactName: 'onnxruntime-java-win-$(buildArch)' + 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 + workspace: + clean: all + pool: 'Win-CPU-2019' + dependsOn: + - Windows_Java_API_Build_CPU_x64 + - Linux_Java_API_Build_CPU_x64 + - MacOS_Java_API_Build_CPU_x64 + condition: succeeded() + steps: + - template: templates/set-version-number-variables-step.yml + + - 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@2 + displayName: 'Download Pipeline Artifact - Linux x64' + inputs: + buildType: 'current' + artifactName: 'drop-onnxruntime-java-linux-x64' + 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' + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' + cleanDestinationFolder: false + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-linux-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' + cleanDestinationFolder: false + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-osx-x64.zip' + destinationFolder: '$(Build.BinariesDirectory)\java-artifact' + cleanDestinationFolder: false + + - task: CmdLine@2 + inputs: + script: | + @echo on + pushd onnxruntime-java-linux-x64 + 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 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' + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.BinariesDirectory)\java-artifact\onnxruntime-java-win-x64' + artifact: 'onnxruntime-java' + publishLocation: 'pipeline' + + - template: templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + +- job: Final_Jar_Testing_Windows + 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' + +- 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} + echo "Java Version" + java --version + 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 ./ + 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' + +- 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: 'onnxruntime-java' + targetPath: '$(Build.BinariesDirectory)/final-jar' + + - task: CmdLine@2 + inputs: + script: | + echo "Java Version" + java --version + 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 ./ + 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/azure-pipelines/linux-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/linux-ci-pipeline.yml index b4ac1a51d235f..e551143ef5296 100644 --- a/tools/ci_build/github/azure-pipelines/linux-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/linux-ci-pipeline.yml @@ -3,7 +3,7 @@ jobs: parameters: AgentPool : 'Linux-CPU' JobName: 'Linux_CI_Dev' - BuildCommand: 'tools/ci_build/github/linux/run_dockerbuild.sh -o ubuntu16.04 -d cpu -r $(Build.BinariesDirectory) -x "--use_mklml --use_llvm --use_nuphar --use_dnnl --use_tvm --build_wheel --build_java --enable_language_interop_ops --use_featurizers --wheel_name_suffix featurizers"' + BuildCommand: 'tools/ci_build/github/linux/run_dockerbuild.sh -o ubuntu16.04 -d cpu -r $(Build.BinariesDirectory) -x "--use_mklml --use_llvm --use_nuphar --use_dnnl --use_tvm --build_wheel --build_java --build_nodejs --enable_language_interop_ops --use_featurizers --wheel_name_suffix featurizers"' DoNugetPack: 'false' ArtifactName: 'drop-linux' TimeoutInMinutes: 120 diff --git a/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml index f294a8aab8c89..f09812dd6a107 100644 --- a/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml @@ -20,22 +20,6 @@ jobs: script: docker build --pull -t onnxruntime-server-ubuntu16.04 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg OS_VERSION=16.04 --build-arg PYTHON_VERSION=3.5 -f Dockerfile.ubuntu_server . workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker - - task: CmdLine@2 - displayName: 'Download azcopy' - inputs: - script: | - curl -so azcopy.tar.gz -L 'https://aka.ms/downloadazcopy-v10-linux' - tar -zxvf azcopy.tar.gz --strip 1 - workingDirectory: $(Build.BinariesDirectory) - - - task: PythonScript@0 - displayName: 'Download test data' - inputs: - scriptPath: '$(Build.SourcesDirectory)/tools/ci_build/github/download_test_data.py' - arguments: --test_data_url $(TestDataUrl) --build_dir $(Build.BinariesDirectory) - pythonInterpreter: '/usr/bin/python3' - workingDirectory: $(Build.BinariesDirectory) - - task: CmdLine@2 displayName: 'Run docker image' inputs: diff --git a/tools/ci_build/github/azure-pipelines/mac-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ci-pipeline.yml index 4096e8c171a05..bce6b0e4f4775 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ci-pipeline.yml @@ -2,4 +2,4 @@ jobs: - template: templates/mac-ci.yml parameters: DoNugetPack: 'false' - BuildCommand: 'python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --build_wheel --skip_submodule_sync --use_featurizers --parallel --build_shared_lib --build_java --enable_language_interop_ops --config Debug' + BuildCommand: 'python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --build_wheel --skip_submodule_sync --use_featurizers --parallel --build_shared_lib --build_java --build_nodejs --enable_language_interop_ops --config Debug' diff --git a/tools/ci_build/github/azure-pipelines/nodejs/cpu-esrp-pipeline.yml b/tools/ci_build/github/azure-pipelines/nodejs/cpu-esrp-pipeline.yml new file mode 100644 index 0000000000000..589aee23a08f4 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/nodejs/cpu-esrp-pipeline.yml @@ -0,0 +1,14 @@ +# schedules: +# - cron: "0 8 * * *" +# displayName: Daily Build +# branches: +# include: +# - master +# always: true + +jobs: +- template: templates/cpu.yml + parameters: + AgentPool : 'Win-CPU-2019' + DoEsrp: 'true' + DoCompliance: 'true' diff --git a/tools/ci_build/github/azure-pipelines/nodejs/templates/cpu.yml b/tools/ci_build/github/azure-pipelines/nodejs/templates/cpu.yml new file mode 100644 index 0000000000000..3de1970e1b069 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/nodejs/templates/cpu.yml @@ -0,0 +1,63 @@ +parameters: + DoEsrp: 'false' + DoCompliance: 'false' + BuildCSharp: 'false' + +jobs: +- template: ../../templates/win-ci-2019.yml + parameters: + AgentPool : 'Win-CPU-2019' + ArtifactName: 'drop-nodejs-win32' + JobName: 'Windows_CI' + BuildCommand: '--build_dir $(Build.BinariesDirectory) --skip_submodule_sync --use_openmp --build_nodejs --enable_onnx_tests --enable_wcos --cmake_generator "Visual Studio 16 2019"' + BuildArch: 'x64' + EnvSetupScript: 'setup_env.bat' + sln_platform: 'x64' + DoDebugBuild: 'false' + DoNodejsPack : 'true' + DoNugetPack: 'false' + DoEsrp: ${{ parameters.DoEsrp }} + DoCompliance: ${{ parameters.DoCompliance }} + BuildCSharp: ${{ parameters.BuildCSharp }} + +- template: ../../templates/mac-ci.yml + parameters: + AgentPool : $(AgentPoolMacOS) + ArtifactName: 'drop-nodejs-darwin' + JobName: 'Mac_CI' + BuildCommand: 'python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --use_openmp --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --use_featurizers --parallel --build_nodejs --config Release' + DoNodejsPack : 'true' + DoNugetPack: 'false' + DoEsrp: ${{ parameters.DoEsrp }} + +- job: 'Linux_CI' + workspace: + clean: all + pool: $(AgentPoolLinux) + steps: + - template: ../../templates/set-version-number-variables-step.yml + - template: ../../templates/linux-set-variables-and-download.yml + - task: CmdLine@2 + inputs: + script: | + sudo docker build --pull -t onnxruntime-ubuntu --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=3.6 -f Dockerfile.ubuntu . + workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker + - task: CmdLine@2 + inputs: + script: | + sudo --preserve-env docker run --rm --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build --volume /data/models:/build/models:ro -e NIGHTLY_BUILD onnxruntime-ubuntu /bin/bash -c "/usr/bin/python3.6 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release --skip_submodule_sync --parallel --build_nodejs --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest --enable_onnx_tests && cd /onnxruntime_src/nodejs && npm pack" + workingDirectory: $(Build.SourcesDirectory) + - script: | + set -e -x + cp $(Build.SourcesDirectory)/nodejs/onnxruntime-*.tgz $(Build.ArtifactStagingDirectory) + cp -R $(Build.SourcesDirectory)/nodejs/prebuilds $(Build.ArtifactStagingDirectory)/prebuilds + displayName: 'Create Artifacts' + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact' + inputs: + artifactName: 'drop-linux' + targetPath: '$(Build.ArtifactStagingDirectory)' + - template: ../../templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + - template: ../../templates/clean-agent-build-directory-step.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/esrp_dll.yml b/tools/ci_build/github/azure-pipelines/templates/esrp_dll.yml deleted file mode 100644 index 175db32f1a5ab..0000000000000 --- a/tools/ci_build/github/azure-pipelines/templates/esrp_dll.yml +++ /dev/null @@ -1,45 +0,0 @@ -parameters: - FolderPath: '' - DisplayName: '' - DoEsrp: 'false' - -steps: -- ${{ if eq(parameters['DoEsrp'], 'true') }}: - - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 - displayName: ${{ parameters.DisplayName }} - inputs: - ConnectedServiceName: 'OnnxRuntime CodeSign 20190817' - FolderPath: ${{ parameters.FolderPath }} - Pattern: '*.dll' - signConfigType: inlineSignParams - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "Microsoft" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, - { - "parameterName": "PageHash", - "parameterValue": "/NPH" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd sha256" - }, - { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" - } - ], - "toolName": "signtool.exe", - "toolVersion": "6.2.9304.0" - } - ] 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..ed020758fae3e --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-posix.yml @@ -0,0 +1,29 @@ +# 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: '' +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}} -h ${{parameters.arch}}' + 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/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..233e80b5e3b29 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/java-api-artifacts-package-and-publish-steps-windows.yml @@ -0,0 +1,60 @@ +# sets up common build tools for the windows build machines before build + +parameters: + buildConfig: 'RelWithDebInfo' + artifactName: 'onnxruntime-java-win-x64' + version: '' + comitId: '' +steps: + - task: CmdLine@2 + inputs: + script: | + @echo on + set NATIVE_FOLDER=$(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ai\onnxruntime\native\win-x64 + mkdir %NATIVE_FOLDER% + echo "Directories created" + copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\${{parameters.artifactName}} + pushd $(Build.BinariesDirectory)\${{parameters.artifactName}} + if ${{parameters.artifactName}} == onnxruntime-java-win-x64 ( + set artifact_id=onnxruntime + ) else ( + set artifact_id=onnxruntime_gpu + ) + jar xf onnxruntime-${{parameters.version}}.jar META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml + move META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\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 + copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\ThirdPartyNotices.txt + @echo ${{parameters.commitId}} > $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage\GIT_COMMIT_ID + pushd $(Build.BinariesDirectory)\${{parameters.artifactName}}\stage + 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 + pushd $(Build.SourcesDirectory)\java\build\classes\java\test + jar cvf $(Build.BinariesDirectory)\${{parameters.artifactName}}\testing.jar . + popd + pushd $(Build.SourcesDirectory)\java\build\resources\test + rd /s /q ai\onnxruntime\native + jar uvf $(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}}' + displayName: 'Add symbols and notices' + + - 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/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..17be34a1c6d12 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/java-test-final-jar-step.yml @@ -0,0 +1,80 @@ +parameters: + WindowsPool: 'Win-CPU-2019' + LinuxPool: 'Linux-CPU' + version: '' + RunMacOs: 'false' + artifactName: '' + +- job: Test_Final_Jar_Linux + 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: 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 + 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: 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}}' + steps: + - 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' diff --git a/tools/ci_build/github/azure-pipelines/templates/linux-ci.yml b/tools/ci_build/github/azure-pipelines/templates/linux-ci.yml index 889f543d72671..556e5c639029d 100644 --- a/tools/ci_build/github/azure-pipelines/templates/linux-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/linux-ci.yml @@ -3,6 +3,7 @@ parameters: JobName : 'Linux_CI_Dev' SubmoduleCheckoutMode: '' BuildCommand: 'tools/ci_build/github/linux/run_dockerbuild.sh -o ubuntu16.04 -d cpu -r $(Build.BinariesDirectory) -x "--use_mklml --use_tvm --build_wheel"' + DoNodejsPack: 'false' DoNugetPack: 'false' NuPackScript: '' ArtifactName: 'drop-linux' @@ -26,6 +27,9 @@ jobs: ${{ if ne(parameters.SubmoduleCheckoutMode, '') }}: submodules: ${{ parameters.SubmoduleCheckoutMode }} - template: linux-set-variables-and-download.yml + - task: NodeTool@0 + inputs: + versionSpec: '12.16.3' - script: ${{ parameters.BuildCommand }} displayName: 'Command Line Script' - task: PublishTestResults@2 @@ -44,6 +48,18 @@ jobs: inputs: artifactName: ${{ parameters.ArtifactName }} targetPath: '$(Build.ArtifactStagingDirectory)' + - ${{ if eq(parameters['DoNodejsPack'], 'true') }}: + - script: | + npm pack + cp $(Build.SourcesDirectory)/nodejs/onnxruntime-*.tgz $(Build.ArtifactStagingDirectory) + cp -R $(Build.SourcesDirectory)/nodejs/prebuilds $(Build.ArtifactStagingDirectory)/prebuilds + workingDirectory: '$(Build.SourcesDirectory)/nodejs' + displayName: 'Create NPM Package' + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}' + inputs: + artifactName: ${{ parameters.ArtifactName }} + targetPath: '$(Build.ArtifactStagingDirectory)' - template: component-governance-component-detection-steps.yml parameters : condition : 'succeeded' diff --git a/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml b/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml index 6b0c2525b3660..38802a86687ab 100644 --- a/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml @@ -2,8 +2,10 @@ parameters: JobName: 'MacOS_CI_Dev' SubmoduleCheckoutMode: '' BuildCommand: '' + DoNodejsPack: 'false' DoNugetPack: 'false' NuPackScript: '' + ArtifactName: 'drop-osx' jobs: - job: ${{ parameters.JobName }} @@ -18,6 +20,9 @@ jobs: - checkout: self ${{ if ne(parameters.SubmoduleCheckoutMode, '') }}: submodules: ${{ parameters.SubmoduleCheckoutMode }} + - task: NodeTool@0 + inputs: + versionSpec: '12.x' - script: | export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home java --version @@ -39,10 +44,36 @@ jobs: ${{ parameters.NuPackScript }} displayName: 'Copy MacOS libs to Artifact Staging' - task: PublishPipelineArtifact@0 - displayName: 'Publish Pipeline Artifact' + displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}' inputs: - artifactName: 'drop-osx' + artifactName: ${{ parameters.ArtifactName }} targetPath: '$(Build.ArtifactStagingDirectory)' + + - ${{ if eq(parameters['DoNodejsPack'], 'true') }}: + # Esrp signing + # + # TODO: ESRP team is working on enable signing workflow on Mac. Should enable the following step when it's ready. + # + # - template: mac-esrp-dll.yml + # parameters: + # FolderPath: '$(Build.SourcesDirectory)/nodejs/bin/napi-v3/darwin/x64' + # DisplayName: 'ESRP - Sign Node.js binding binaries' + # DoEsrp: ${{ parameters.DoEsrp }} + # Pattern: '*.dylib,*.node' + + - script: | + npm pack + cp $(Build.SourcesDirectory)/nodejs/onnxruntime-*.tgz $(Build.ArtifactStagingDirectory) + cp -R $(Build.SourcesDirectory)/nodejs/prebuilds $(Build.ArtifactStagingDirectory)/prebuilds + workingDirectory: '$(Build.SourcesDirectory)/nodejs' + displayName: 'Create NPM Package' + + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}' + inputs: + artifactName: ${{ parameters.ArtifactName }} + targetPath: '$(Build.ArtifactStagingDirectory)' + - template: component-governance-component-detection-steps.yml parameters : condition : 'succeeded' diff --git a/tools/ci_build/github/azure-pipelines/templates/mac-esrp-dll.yml b/tools/ci_build/github/azure-pipelines/templates/mac-esrp-dll.yml new file mode 100644 index 0000000000000..36941231db1c6 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/mac-esrp-dll.yml @@ -0,0 +1,45 @@ +parameters: + FolderPath: '' + DisplayName: '' + DoEsrp: 'false' + Pattern: '*.dll' + +steps: +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: ${{ parameters.DisplayName }} + inputs: + ConnectedServiceName: 'OnnxRuntime CodeSign 20190817' + FolderPath: ${{ parameters.FolderPath }} + Pattern: ${{ parameters.Pattern }} + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd sha256" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "signtool", + "toolVersion": "6.2.9304.0" + } + ] diff --git a/tools/ci_build/github/azure-pipelines/templates/win-ci-2019.yml b/tools/ci_build/github/azure-pipelines/templates/win-ci-2019.yml index df02a41a43240..ec16ef3c4ca91 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-ci-2019.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-ci-2019.yml @@ -3,9 +3,11 @@ parameters: DoCompliance: 'false' BuildCommand: '' JobName: 'Windows_CI_Dev' + BuildCSharp: 'true' DoNugetPack: 'false' NuPackScript : '' ArtifactName: 'drop-nuget' + DoNodejsPack: 'false' DoEsrp: 'false' DoTestCoverage: 'false' BuildArch: 'x64' # Optional. Options: x86, x64 @@ -56,6 +58,11 @@ jobs: displayName: 'Create TraceLoggingConfigPrivate.h For WinML Telemetry' env: TELEMETRYGUID: $(TELEMETRYGUID) + + - task: NodeTool@0 + inputs: + versionSpec: '12.x' + - task: UsePythonVersion@0 inputs: versionSpec: '3.7' @@ -108,36 +115,40 @@ jobs: createLogFile: true # The Configuration variable is required to build C# - - script: | - @echo ##vso[task.setvariable variable=Configuration]$(BuildConfig) - displayName: 'Set Configuration variable' + - ${{ if eq(parameters.BuildCSharp, true) }}: + - script: | + @echo ##vso[task.setvariable variable=Configuration]$(BuildConfig) + displayName: 'Set Configuration variable' - template: set-test-data-variables-step.yml - - task: NuGetToolInstaller@0 - displayName: Use Nuget 4.9 - inputs: - versionSpec: 4.9.4 + - ${{ if eq(parameters.BuildCSharp, true) }}: + - task: NuGetToolInstaller@0 + displayName: Use Nuget 4.9 + inputs: + versionSpec: 4.9.4 - - task: DotNetCoreCLI@2 - displayName: 'Restore nuget packages' - inputs: - command: restore - projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln' - configuration: '$(BuildConfig)' - arguments: '--configuration $(BuildConfig) -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId }}' - workingDirectory: '$(Build.SourcesDirectory)\csharp' + - ${{ if eq(parameters.BuildCSharp, true) }}: + - task: DotNetCoreCLI@2 + displayName: 'Restore nuget packages' + inputs: + command: restore + projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln' + configuration: '$(BuildConfig)' + arguments: '--configuration $(BuildConfig) -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId }}' + workingDirectory: '$(Build.SourcesDirectory)\csharp' - - task: DotNetCoreCLI@2 - displayName: 'Build C#' - inputs: - command: build - projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln' - configuration: '$(BuildConfig)' - arguments: '--configuration $(BuildConfig) -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=${{ parameters.OrtPackageId }}' - workingDirectory: '$(Build.SourcesDirectory)\csharp' + - ${{ if eq(parameters.BuildCSharp, true) }}: + - task: DotNetCoreCLI@2 + displayName: 'Build C#' + inputs: + command: build + projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln' + configuration: '$(BuildConfig)' + arguments: '--configuration $(BuildConfig) -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=${{ parameters.OrtPackageId }}' + workingDirectory: '$(Build.SourcesDirectory)\csharp' - - ${{ if in(parameters['sln_platform'], 'Win32', 'x64') }}: + - ${{ if and(eq(parameters.BuildCSharp, true), in(parameters['sln_platform'], 'Win32', 'x64')) }}: - task: DotNetCoreCLI@2 displayName: 'Test C#' inputs: @@ -170,7 +181,7 @@ jobs: condition: succeededOrFailed() # Nuget packaging if needed - - ${{ if eq(parameters['DoNugetPack'], 'true') }}: + - ${{ if and(eq(parameters.BuildCSharp, true), eq(parameters['DoNugetPack'], 'true')) }}: - task: BatchScript@1 displayName: 'Setup VS2019 env vars' inputs: @@ -178,13 +189,13 @@ jobs: arguments: ${{ parameters.BuildArch }} modifyEnvironment: true # Esrp signing - - template: esrp_dll.yml + - template: win-esrp-dll.yml parameters: FolderPath: '$(Build.BinariesDirectory)\$(BuildConfig)' DisplayName: 'ESRP - Sign Native dlls' DoEsrp: ${{ parameters.DoEsrp }} - - template: esrp_dll.yml + - template: win-esrp-dll.yml parameters: FolderPath: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\$(BuildConfig)' DisplayName: 'ESRP - Sign C# dlls' @@ -209,6 +220,35 @@ jobs: searchPattern: '**/*.pdb' symbolServerType: teamServices + # Node.js Publish + - ${{ if eq(parameters['DoNodejsPack'], 'true') }}: + - task: BatchScript@1 + displayName: 'Setup VS2019 env vars' + inputs: + filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat' + arguments: ${{ parameters.BuildArch }} + modifyEnvironment: true + - template: win-esrp-dll.yml + parameters: + FolderPath: '$(Build.SourcesDirectory)\nodejs\bin\napi-v3\win32\x64' + DisplayName: 'ESRP - Sign Node.js binding binaries' + DoEsrp: ${{ parameters.DoEsrp }} + Pattern: '*.dll,*.node' + + - script: | + del /Q $(Build.SourcesDirectory)\nodejs\bin\napi-v3\win32\x64\CodeSignSummary-*.* + call npm pack + copy $(Build.SourcesDirectory)\nodejs\onnxruntime-*.tgz $(Build.ArtifactStagingDirectory) + xcopy /E /I $(Build.SourcesDirectory)\nodejs\prebuilds $(Build.ArtifactStagingDirectory)\prebuilds + workingDirectory: '$(Build.SourcesDirectory)\nodejs' + displayName: 'Create NPM Package' + + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}' + inputs: + artifactName: ${{ parameters.ArtifactName }} + targetPath: '$(Build.ArtifactStagingDirectory)' + # Compliance tasks require logs from Debug Build - ${{ if eq(parameters['DoCompliance'], 'true') }}: - template: compliance.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/win-ci-arm.yml b/tools/ci_build/github/azure-pipelines/templates/win-ci-arm.yml index 765f09cdea8aa..7c321b650a875 100644 --- a/tools/ci_build/github/azure-pipelines/templates/win-ci-arm.yml +++ b/tools/ci_build/github/azure-pipelines/templates/win-ci-arm.yml @@ -95,7 +95,7 @@ jobs: # Nuget packaging if needed - ${{ if eq(parameters['DoNugetPack'], 'true') }}: # Esrp signing - - template: esrp_dll.yml + - template: win-esrp-dll.yml parameters: FolderPath: '$(Build.BinariesDirectory)\RelWithDebInfo' DisplayName: 'ESRP - Sign Native dlls' diff --git a/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml b/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml new file mode 100644 index 0000000000000..ef4ab57300952 --- /dev/null +++ b/tools/ci_build/github/azure-pipelines/templates/win-esrp-dll.yml @@ -0,0 +1,45 @@ +parameters: + FolderPath: '' + DisplayName: '' + DoEsrp: 'false' + Pattern: '*.dll' + +steps: +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: ${{ parameters.DisplayName }} + inputs: + ConnectedServiceName: 'OnnxRuntime CodeSign 20190817' + FolderPath: ${{ parameters.FolderPath }} + Pattern: ${{ parameters.Pattern }} + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd sha256" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "signtool.exe", + "toolVersion": "6.2.9304.0" + } + ] diff --git a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml index 27401a1ed3f2b..30da049427275 100644 --- a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml +++ b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml @@ -134,7 +134,7 @@ steps: modifyEnvironment: true # Esrp signing - - template: esrp_dll.yml + - template: win-esrp-dll.yml parameters: FolderPath: '$(Build.BinariesDirectory)\RelWithDebInfo' DisplayName: 'ESRP - Sign Native dlls' diff --git a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml index 1f828f1fd5bfa..0f206ed32f686 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml @@ -26,6 +26,10 @@ jobs: addToPath: true architecture: $(buildArch) + - task: NodeTool@0 + inputs: + versionSpec: '12.x' + - task: BatchScript@1 displayName: 'setup env' inputs: @@ -65,7 +69,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --use_featurizers --use_dnnl --use_winml --use_openmp --build_shared_lib --enable_onnx_tests --enable_wcos --build_java' + arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --use_featurizers --use_dnnl --use_winml --use_openmp --build_shared_lib --enable_onnx_tests --enable_wcos --build_java --build_nodejs' workingDirectory: '$(Build.BinariesDirectory)' - task: VSBuild@1 @@ -137,73 +141,6 @@ jobs: - template: templates/clean-agent-build-directory-step.yml -- job: 'static_analysis' - pool: 'Win-CPU-2019' - variables: - OrtPackageId: 'Microsoft.ML.OnnxRuntime' - MsbuildArguments: '-maxcpucount' - OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)' - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - EnvSetupScript: setup_env.bat - buildArch: x64 - BuildConfig: 'Debug' - setVcvars: true - timeoutInMinutes: 60 - workspace: - clean: all - 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 - mkdir $(Build.SourcesDirectory)\$(BuildConfig) - 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' - - - task: CMake@1 - inputs: - workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)' - cmakeArgs: $(Build.SourcesDirectory)\cmake -Donnxruntime_RUN_ONNX_TESTS=OFF -Donnxruntime_DEV_MODE=ON -Donnxruntime_USE_CUDA=OFF -Donnxruntime_USE_NSYNC=OFF -Donnxruntime_CUDNN_HOME= -Donnxruntime_USE_FEATURIZERS=OFF -Donnxruntime_CUDA_HOME= -Donnxruntime_USE_JEMALLOC=OFF -Donnxruntime_USE_MIMALLOC=OFF -Donnxruntime_ENABLE_PYTHON=OFF -Donnxruntime_BUILD_CSHARP=OFF -Donnxruntime_BUILD_JAVA=OFF -Donnxruntime_BUILD_SHARED_LIB=ON -Donnxruntime_USE_EIGEN_FOR_BLAS=ON -Donnxruntime_USE_OPENBLAS=OFF -Donnxruntime_USE_DNNL=OFF -Donnxruntime_USE_MKLML=OFF -Donnxruntime_USE_OPENMP=OFF -Donnxruntime_USE_FULL_PROTOBUF=OFF -Donnxruntime_DISABLE_CONTRIB_OPS=OFF -Donnxruntime_MSVC_STATIC_RUNTIME=OFF -Donnxruntime_USE_DML=OFF -Donnxruntime_USE_TELEMETRY=OFF -A x64 -T host=x64 -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=$(BuildConfig) -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -Donnxruntime_PREFER_SYSTEM_LIB=ON -Donnxruntime_ENABLE_STATIC_ANALYSIS=ON - - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.BinariesDirectory)\$(BuildConfig)\onnxruntime.sln' - platform: 'x64' - configuration: $(BuildConfig) - msbuildArgs: $(MsbuildArguments) - msbuildArchitecture: $(buildArch) - maximumCpuCount: true - logProjectEvents: false - workingFolder: '$(Build.BinariesDirectory)\$(BuildConfig)' - createLogFile: true - - - template: templates/component-governance-component-detection-steps.yml - parameters : - condition : 'succeeded' - - - template: templates/clean-agent-build-directory-step.yml - - job: 'x86_build' pool: 'Win-CPU-2019' strategy: diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml index f4c01898ce5cc..39ce6676855ce 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml @@ -42,7 +42,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --use_featurizers --use_dnnl --build_shared_lib --enable_onnx_tests --use_dml --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" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0' + arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --use_featurizers --use_dnnl --build_shared_lib --build_java --enable_onnx_tests --use_dml --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" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0' workingDirectory: '$(Build.BinariesDirectory)' - task: VSBuild@1 @@ -107,7 +107,7 @@ jobs: del wheel_filename_file python.exe -m pip install -q --upgrade %WHEEL_FILENAME% set PATH=$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig);%PATH% - python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_wheel --use_featurizers --use_dnnl --build_shared_lib --enable_onnx_tests --use_dml --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" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 + python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_wheel --build_java --use_featurizers --use_dnnl --build_shared_lib --enable_onnx_tests --use_dml --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" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)' displayName: 'Run tests' diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml index 84a47ee3b9d95..880cb9e647d89 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml @@ -42,7 +42,7 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-7.0.0.11.cuda-10.2.cudnn7.6\TensorRT-7.0.0.11" --cuda_version=10.2 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2" --cudnn_home="C:\local\cudnn-10.2-windows10-x64-v7.6.5.32\cuda" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0' + arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --msvc_toolset 14.16 --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-7.0.0.11.cuda-10.2.cudnn7.6\TensorRT-7.0.0.11" --cuda_version=10.2 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2" --cudnn_home="C:\local\cudnn-10.2-windows10-x64-v7.6.5.32\cuda" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0' workingDirectory: '$(Build.BinariesDirectory)' - task: VSBuild@1 @@ -75,7 +75,7 @@ jobs: del wheel_filename_file python.exe -m pip install -q --upgrade %WHEEL_FILENAME% set PATH=$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig);%PATH% - python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-7.0.0.11.cuda-10.2.cudnn7.6\TensorRT-7.0.0.11" --cuda_version=10.2 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2" --cudnn_home="C:\local\cudnn-10.2-windows10-x64-v7.6.5.32\cuda" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 + python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 16 2019" --msvc_toolset 14.16 --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-7.0.0.11.cuda-10.2.cudnn7.6\TensorRT-7.0.0.11" --cuda_version=10.2 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2" --cudnn_home="C:\local\cudnn-10.2-windows10-x64-v7.6.5.32\cuda" --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)' displayName: 'Run tests' diff --git a/tools/ci_build/github/linux/docker/Dockerfile.centos6 b/tools/ci_build/github/linux/docker/Dockerfile.centos6 index 3a13e5e9f3578..a52cf3192894e 100644 --- a/tools/ci_build/github/linux/docker/Dockerfile.centos6 +++ b/tools/ci_build/github/linux/docker/Dockerfile.centos6 @@ -2,8 +2,10 @@ 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 +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 c5005b2f224c5..adcbaaf7479a6 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 ${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_centos.sh b/tools/ci_build/github/linux/docker/scripts/install_centos.sh index 5b779c4cd56ff..0d041690fc199 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" ] 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..65298fe304feb 100755 --- a/tools/ci_build/github/linux/docker/scripts/install_deps.sh +++ b/tools/ci_build/github/linux/docker/scripts/install_deps.sh @@ -81,6 +81,9 @@ if [[ $SYS_LONG_BIT = "64" && "$GLIBC_VERSION" -gt "9" ]]; then echo "Installing cmake" GetFile https://github.com/Kitware/CMake/releases/download/v3.13.5/cmake-3.13.5-Linux-x86_64.tar.gz /tmp/src/cmake-3.13.5-Linux-x86_64.tar.gz tar -zxf /tmp/src/cmake-3.13.5-Linux-x86_64.tar.gz --strip=1 -C /usr + echo "Installing Node.js" + GetFile https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz /tmp/src/node-v12.16.3-linux-x64.tar.xz + tar -xf /tmp/src/node-v12.16.3-linux-x64.tar.xz --strip=1 -C /usr else echo "Installing cmake" GetFile https://github.com/Kitware/CMake/releases/download/v3.13.5/cmake-3.13.5.tar.gz /tmp/src/cmake-3.13.5.tar.gz @@ -93,10 +96,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 new file mode 100755 index 0000000000000..568a11bf96c8e --- /dev/null +++ b/tools/ci_build/github/linux/java_copy_strip_binary.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -e -o -x + +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};; +h) ARCH=${OPTARG};; +v) VERSION_NUMBER=${OPTARG};; +esac +done + +EXIT_CODE=1 + +uname -a + +echo "Version: $VERSION_NUMBER" +NATIVE_FOLDER=ai/onnxruntime/native/$ARCH + +mkdir -p $BINARY_DIR/$ARTIFACT_NAME/$NATIVE_FOLDER + +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/$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/$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/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/libcustom_op_library.so $BINARY_DIR/$ARTIFACT_NAME +fi + +find $BINARY_DIR/$ARTIFACT_NAME -ls +rm -fr $BINARY_DIR/$ARTIFACT_NAME/jar + +EXIT_CODE=$? + +set -e +exit $EXIT_CODE 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 100755 index 0000000000000..d25af6a791198 --- /dev/null +++ b/tools/ci_build/github/linux/java_linux_final_test.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# This is for testing GPU final jar on Linux +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 + +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 + +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 -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=$? + +set -e +exit $EXIT_CODE diff --git a/tools/python/update_version.py b/tools/python/update_version.py index 2aa4712823f29..5bb4c3e88fb0a 100755 --- a/tools/python/update_version.py +++ b/tools/python/update_version.py @@ -1,4 +1,5 @@ import os +import json def update_version(): version = '' @@ -84,5 +85,19 @@ def update_version(): continue f.write(line) + # update version for node.js binding + current_version = '' + file_names = ['package.json', 'package-lock.json'] + file_paths = [os.path.join(cwd, '..', '..', 'nodejs', file_name) for file_name in file_names] + for file_path in file_paths: + with open(file_path) as f: + content = json.load(f) + current_version = content['version'] + if version != current_version: + content['version'] = version + with open(file_path, 'w') as f: + json.dump(content, f, indent=2) + + if __name__ == "__main__": update_version()