From bcd331d145e5c1c34190d603e554e1dd6e0535e2 Mon Sep 17 00:00:00 2001 From: Andrey Kashchikhin Date: Mon, 2 Oct 2023 18:45:17 +0100 Subject: [PATCH] [CI] [GHA] Transfer Linux ONNX Runtime to AKS runners (#20157) * transition to aks runners * correct name * incorporate onnxruntime into linux pipeline * add missing python installation * install build dependencies * add path * rm unused * mv stage * correct dir * use 16-core for onnxruntime job * rm obsolete * rm logs * rm unnecessary step * rm unnecessary dir creation --- .github/workflows/linux.yml | 134 +++++++++++++++++ .github/workflows/linux_onnxruntime.yml | 182 ------------------------ 2 files changed, 134 insertions(+), 182 deletions(-) delete mode 100644 .github/workflows/linux_onnxruntime.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index aae1d593602..052f8ebfcd6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -59,6 +59,7 @@ jobs: CCACHE_DIR: /mount/caches/ccache/ubuntu20_x86_64_Release CCACHE_TEMPDIR: /__w/openvino/openvino/ccache_temp CCACHE_MAXSIZE: 50G + ONNX_RUNTIME_UTILS: /__w/openvino/openvino/openvino/.ci/azure/ci_utils/onnxruntime steps: - name: Install git @@ -157,6 +158,12 @@ jobs: - name: Pack Artifacts run: | + + # Add the ONNX Runtime version and skip tests list to the archive to use in the ONNX Runtime Job + # w/o the need to checkout repository + + cp -R ${ONNX_RUNTIME_UTILS} ${INSTALL_DIR} + pushd ${INSTALL_DIR} tar -czvf ${BUILD_DIR}/openvino_package.tar.gz * popd @@ -377,6 +384,133 @@ jobs: path: ${{ env.INSTALL_TEST_DIR }}/TEST*.xml if-no-files-found: 'error' + ONNX_Runtime: + needs: Build + defaults: + run: + shell: bash + runs-on: aks-linux-16-cores + container: + image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04 + volumes: + - /mount/caches:/mount/caches + env: + DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input + CMAKE_GENERATOR: 'Ninja Multi-Config' + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_C_COMPILER_LAUNCHER: ccache + OPENVINO_REPO: /__w/openvino/openvino/openvino + INSTALL_DIR: /__w/openvino/openvino/install + CCACHE_DIR: /mount/caches/ccache/ubuntu20_x86_64_onnxruntime + CCACHE_TEMPDIR: /__w/openvino/openvino/ccache_temp + CCACHE_MAXSIZE: 50G + ONNX_RUNTIME_REPO: /__w/openvino/openvino/onnxruntime + ONNX_RUNTIME_UTILS: /__w/openvino/openvino/install/onnxruntime + ONNX_RUNTIME_BUILD_DIR: /__w/openvino/openvino/onnxruntime/build + + steps: + + - name: Fetch install_build_dependencies.sh + uses: actions/checkout@v4 + with: + sparse-checkout: | + install_build_dependencies.sh + sparse-checkout-cone-mode: false + path: ${{ env.OPENVINO_REPO }} + + - name: Install git + run: | + apt-get update + apt-get install --assume-yes --no-install-recommends git ca-certificates + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + # + # Initialize OpenVINO + # + + - name: Download OpenVINO package + uses: actions/download-artifact@v3 + with: + name: openvino_package + path: ${{ env.INSTALL_DIR }} + + - name: Extract OpenVINO package + run: | + pushd ${INSTALL_DIR} + tar -xzf openvino_package.tar.gz -C ${INSTALL_DIR} && rm openvino_package.tar.gz + popd + + - name: Install OpenVINO dependencies + run: ${INSTALL_DIR}/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -y + + - name: Clone ONNX Runtime + run: | + branch=`tr -s '\n ' < ${ONNX_RUNTIME_UTILS}/version` + git clone --branch $branch --single-branch --recursive https://github.com/microsoft/onnxruntime.git ${ONNX_RUNTIME_REPO} + + # + # Tests + # + + - name: Install Build Dependencies + run: bash ${OPENVINO_REPO}/install_build_dependencies.sh + + - name: Build Lin ONNX Runtime + run: | + source ${INSTALL_DIR}/setupvars.sh + + ${ONNX_RUNTIME_REPO}/build.sh \ + --config RelWithDebInfo \ + --use_openvino CPU_FP32 \ + --build_shared_lib \ + --parallel \ + --skip_tests \ + --compile_no_warning_as_error \ + --build_dir ${ONNX_RUNTIME_BUILD_DIR} + env: + CXXFLAGS: "-Wno-error=deprecated-declarations" + + - name: Run onnxruntime_test_all + run: | + source ${INSTALL_DIR}/setupvars.sh + skip_tests=$(tr -s '\n ' ':' < ${ONNX_RUNTIME_UTILS}/skip_tests) + + ./onnxruntime_test_all --gtest_filter=-$skip_tests + working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo + + - name: Run onnxruntime_shared_lib_test + run: | + source ${INSTALL_DIR}/setupvars.sh + ./onnxruntime_shared_lib_test --gtest_filter=-CApiTest.test_custom_op_openvino_wrapper_library + working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo + + - name: Run onnxruntime_global_thread_pools_test + run: | + source ${INSTALL_DIR}/setupvars.sh + ./onnxruntime_global_thread_pools_test + working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo + + - name: Run onnxruntime_api_tests_without_env + run: | + source ${INSTALL_DIR}/setupvars.sh + ./onnxruntime_api_tests_without_env + working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo + + - name: Run pytorch-converted tests + run: | + source ${INSTALL_DIR}/setupvars.sh + ./onnx_test_runner "${ONNX_RUNTIME_REPO}/cmake/external/onnx/onnx/backend/test/data/pytorch-converted" + working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo + + - name: Run pytorch-operator tests + run: | + source ${INSTALL_DIR}/setupvars.sh + ./onnx_test_runner "${ONNX_RUNTIME_REPO}/cmake/external/onnx/onnx/backend/test/data/pytorch-operator" + working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo/RelWithDebInfo + CXX_Unit_Tests: needs: Build defaults: diff --git a/.github/workflows/linux_onnxruntime.yml b/.github/workflows/linux_onnxruntime.yml deleted file mode 100644 index 178aae4fefa..00000000000 --- a/.github/workflows/linux_onnxruntime.yml +++ /dev/null @@ -1,182 +0,0 @@ -name: Linux ONNX Runtime (Ubuntu 20.04, Python 3.11) -on: - workflow_dispatch: - schedule: - # run daily at 00:00 - - cron: '0 0 * * *' -# pull_request: -# paths-ignore: -# - '**/docs/**' -# - 'docs/**' -# - '**/**.md' -# - '**.md' -# - '**/layer_tests_summary/**' -# - '**/conformance/**' -# push: -# paths-ignore: -# - '**/docs/**' -# - 'docs/**' -# - '**/**.md' -# - '**.md' -# - '**/layer_tests_summary/**' -# - '**/conformance/**' -# branches: -# - master - -concurrency: - group: ${{ github.head_ref || github.run_id }}-linux-onnx-runtime - cancel-in-progress: true - -jobs: - Build: - # TODO: remove. Temporary measure to prevent the workflow from scheduling on forks. - if: ${{ github.repository_owner == 'openvinotoolkit' }} - defaults: - run: - shell: bash - runs-on: ubuntu-20.04-8-cores - env: - CMAKE_BUILD_TYPE: 'Release' - CMAKE_GENERATOR: 'Ninja' - CMAKE_CXX_COMPILER_LAUNCHER: ccache - CMAKE_C_COMPILER_LAUNCHER: ccache - CMAKE_CXX_LINKER_LAUNCHER: ccache - CMAKE_C_LINKER_LAUNCHER: ccache - BUILD_TYPE: Release - OPENVINO_REPO: ${{ github.workspace }}/openvino - ONNX_RUNTIME_REPO: ${{ github.workspace }}/onnxruntime - ONNX_RUNTIME_UTILS: ${{ github.workspace }}/openvino/.ci/azure/ci_utils/onnxruntime - ONNX_RUNTIME_BUILD_DIR: ${{ github.workspace }}/onnxruntime/build - BUILD_DIR: ${{ github.workspace }}/build - INSTALL_DIR: ${{ github.workspace }}/install/openvino - steps: - - name: Clone OpenVINO - uses: actions/checkout@v4 - with: - path: 'openvino' - submodules: 'true' - - - name: Clone ONNX Runtime - run: | - branch=`tr -s '\n ' < ${{ env.ONNX_RUNTIME_UTILS }}/version` - git clone --branch $branch --single-branch --recursive https://github.com/microsoft/onnxruntime.git ${{ env.ONNX_RUNTIME_REPO }} - - - name: Create Directories - run: | - mkdir -p ${{ env.BUILD_DIR }} - mkdir -p ${{ env.INSTALL_DIR }} - - - name: Setup Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - # - # Dependencies - # - - - name: Install build dependencies - run: | - sudo -E ${{ env.OPENVINO_REPO }}/install_build_dependencies.sh - - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - max-size: "2000M" - # Should save cache only if run in the master branch of the base repo - # github.ref_name is 'ref/PR_#' in case of the PR, and 'branch_name' when executed on push - save: ${{ github.ref_name == 'master' && 'true' || 'false' }} - verbose: 2 - key: ${{ github.job }}-linux-onnx-runtime - restore-keys: | - ${{ github.job }}-linux-onnx-runtime - - # - # Build - # - - - name: Get number of CPU cores - uses: SimenB/github-actions-cpu-cores@v2 - id: cpu-cores - - - name: CMake configure - run: | - cmake \ - -GNinja \ - -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ - -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ - -DENABLE_INTEL_GNA=OFF \ - -DENABLE_INTEL_GPU=OFF \ - -DENABLE_CPPLINT=OFF \ - -DENABLE_PROFILING_ITT=OFF \ - -DENABLE_SAMPLES=OFF \ - -DENABLE_OV_TF_FRONTEND=OFF \ - -DENABLE_OV_TF_LITE=OFF \ - -DENABLE_OV_PADDLE_FRONTEND=OFF \ - -DENABLE_OV_PYTORCH_FRONTEND=OFF \ - -S ${{ env.OPENVINO_REPO }} \ - -B ${{ env.BUILD_DIR }} - - - name: Clean ccache stats - run: ccache --zero-stats --show-config - - - name: Build - run: cmake --build ${{ env.BUILD_DIR }} --parallel ${{ steps.cpu-cores.outputs.count }} --config ${{ env.BUILD_TYPE }} - - - name: Show ccache stats - run: ccache --show-stats - - - name: Install OpenVINO - run: cmake -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -P ${{ env.BUILD_DIR }}/cmake_install.cmake - - - name: Build Lin ONNX Runtime - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - - ${{ env.ONNX_RUNTIME_REPO }}/build.sh \ - --config RelWithDebInfo \ - --use_openvino CPU_FP32 \ - --build_shared_lib \ - --parallel \ - --skip_tests \ - --compile_no_warning_as_error \ - --build_dir ${{ env.ONNX_RUNTIME_BUILD_DIR }} - env: - CXXFLAGS: "-Wno-error=deprecated-declarations" - - - name: Run onnxruntime_test_all - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - skip_tests=$(tr -s '\n ' ':' < ${{ env.ONNX_RUNTIME_UTILS }}/skip_tests) - ./onnxruntime_test_all --gtest_filter=-$skip_tests - working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo - - - name: Run onnxruntime_shared_lib_test - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - ./onnxruntime_shared_lib_test --gtest_filter=-CApiTest.test_custom_op_openvino_wrapper_library - working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo - - - name: Run onnxruntime_global_thread_pools_test - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - ./onnxruntime_global_thread_pools_test - working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo - - - name: Run onnxruntime_api_tests_without_env - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - ./onnxruntime_api_tests_without_env - working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo - - - name: Run pytorch-converted tests - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - ./onnx_test_runner "${{ env.ONNX_RUNTIME_REPO }}/cmake/external/onnx/onnx/backend/test/data/pytorch-converted" - working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo - - - name: Run pytorch-operator tests - run: | - source ${{ env.INSTALL_DIR }}/setupvars.sh - ./onnx_test_runner "${{ env.ONNX_RUNTIME_REPO }}/cmake/external/onnx/onnx/backend/test/data/pytorch-operator" - working-directory: ${{ env.ONNX_RUNTIME_BUILD_DIR }}/RelWithDebInfo