From 32e12291458612578f5df5f623b3a2abb5018665 Mon Sep 17 00:00:00 2001 From: Andrey Kashchikhin Date: Fri, 15 Sep 2023 13:24:44 +0100 Subject: [PATCH] [CI] [GHA] Introduce GHA Linux Conditional Compilation Pipeline (#19341) * introduce linux cc * disable some triggers * check dirs * use another model * return model * rm triggers --------- Co-authored-by: Mikhail Ryzhov --- .../linux_conditional_compilation.yml | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 .github/workflows/linux_conditional_compilation.yml diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml new file mode 100644 index 00000000000000..5522dce84e9c52 --- /dev/null +++ b/.github/workflows/linux_conditional_compilation.yml @@ -0,0 +1,142 @@ +name: Linux Conditional Compilation (Ubuntu 22.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-cc + 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-latest-8-cores + env: + CMAKE_BUILD_TYPE: 'Release' + CMAKE_GENERATOR: 'Ninja' + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_C_COMPILER_LAUNCHER: ccache + OPENVINO_REPO: ${{ github.workspace }}/openvino + OPENVINO_CONTRIB_REPO: ${{ github.workspace }}/openvino_contrib + BUILD_DIR: ${{ github.workspace }}/build + DATA_PATH: ${{ github.workspace }}/testdata + MODELS_PATH: ${{ github.workspace }}/testdata + OV_TEMP: ${{ github.workspace }}/openvino_temp + PYTHON_STATIC_ARGS: -m "not dynamic_library and not template_plugin" + steps: + - name: Clone OpenVINO + uses: actions/checkout@v3 + with: + path: 'openvino' + submodules: 'recursive' + + - name: Clone testdata for C API tests + uses: actions/checkout@v3 + with: + repository: 'openvinotoolkit/testdata' + path: 'testdata' + submodules: 'recursive' + lfs: 'true' + + # + # Dependencies + # + + - name: Install build dependencies + run: | + sudo -E ${{ env.OPENVINO_REPO }}/install_build_dependencies.sh + sudo -E apt update + sudo -E apt --assume-yes install openjdk-11-jdk libbz2-dev clang unzip libpugixml-dev libtbb-dev intel-opencl-icd ocl-icd-opencl-dev opencl-headers + + wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip + unzip ninja-linux.zip + sudo cp -v ninja /usr/local/bin/ + + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + + # + # Build + # + + - 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: linux-cc + restore-keys: | + linux-cc + + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v2 + id: cpu-cores + + - name: CMake configure CC COLLECT + run: | + cmake \ + -G "Ninja Multi-Config" \ + -DENABLE_CPPLINT=OFF \ + -DENABLE_GAPI_PREPROCESSING=OFF \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ + -DENABLE_FASTER_BUILD=ON \ + -DENABLE_PROFILING_ITT=ON \ + -DSELECTIVE_BUILD=COLLECT \ + -S ${{ env.OPENVINO_REPO }} \ + -B ${{ env.BUILD_DIR }} + + - name: Clean ccache stats + run: ccache --zero-stats --show-config + + - name: Build CC COLLECT + run: cmake --build ${{ env.BUILD_DIR }} --parallel ${{ steps.cpu-cores.outputs.count }} --config Release --target openvino_intel_cpu_plugin openvino_ir_frontend benchmark_app sea_itt_lib + + - name: Show ccache stats + run: ccache --show-stats + + - name: Code usage analysis + run: | + python3 ${{ env.OPENVINO_REPO }}/thirdparty/itt_collector/runtool/sea_runtool.py \ + --bindir ${{ env.OPENVINO_REPO }}/bin/intel64/Release -o ${{ env.BUILD_DIR }}/itt_stat ! \ + ${{ env.OPENVINO_REPO }}/bin/intel64/Release/benchmark_app -niter 1 -nireq 1 \ + -m ${{ env.MODELS_PATH }}/models/test_model/test_model_fp32.xml -d CPU + + - name: CMake configure with CC ON + run: cmake -DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=${{ env.BUILD_DIR }}/*.csv -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }} + + - name: Build with CC ON + run: cmake --build ${{ env.BUILD_DIR }} --parallel ${{ steps.cpu-cores.outputs.count }} --config Release --target openvino_intel_cpu_plugin openvino_ir_frontend + + - name: Use OpenVINO after CC + run: | + ${{ env.OPENVINO_REPO }}/bin/intel64/Release/benchmark_app -niter 1 -nireq 1 \ + -m ${{ env.MODELS_PATH }}/models/test_model/test_model_fp32.xml -d CPU