|
| 1 | +name: Performance |
| 2 | + |
| 3 | +on: |
| 4 | + # Can be triggered via manual "dispatch" (from workflow view in GitHub Actions tab) |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + pr_no: |
| 8 | + description: PR number (if 0, it'll run on the main) |
| 9 | + type: number |
| 10 | + required: true |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + pull-requests: write |
| 15 | + |
| 16 | +env: |
| 17 | + BUILD_DIR : "${{github.workspace}}/build" |
| 18 | + |
| 19 | +jobs: |
| 20 | + perf-l0: |
| 21 | + name: Build UMF and run performance tests |
| 22 | + runs-on: "L0_PERF" |
| 23 | + |
| 24 | + steps: |
| 25 | + # Workspace on self-hosted runners is not cleaned automatically. |
| 26 | + # We have to delete the files created outside of using actions. |
| 27 | + - name: Cleanup self-hosted workspace |
| 28 | + if: always() |
| 29 | + run: | |
| 30 | + ls -la ./ |
| 31 | + rm -rf ./* || true |
| 32 | +
|
| 33 | + - name: Add comment to PR |
| 34 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
| 35 | + if: ${{ always() && inputs.pr_no != 0 }} |
| 36 | + with: |
| 37 | + script: | |
| 38 | + const pr_no = '${{ inputs.pr_no }}'; |
| 39 | + const provider = 'LEVEL_ZERO'; |
| 40 | + const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; |
| 41 | + const body = `Performance workflow for ${provider}_PROVIDER run:\n${url}`; |
| 42 | +
|
| 43 | + github.rest.issues.createComment({ |
| 44 | + issue_number: pr_no, |
| 45 | + owner: context.repo.owner, |
| 46 | + repo: context.repo.repo, |
| 47 | + body: body |
| 48 | + }) |
| 49 | +
|
| 50 | + - name: Checkout UMF |
| 51 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 52 | + |
| 53 | + - name: Get information about platform |
| 54 | + run: .github/scripts/get_system_info.sh |
| 55 | + |
| 56 | + # We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged. |
| 57 | + - name: Fetch PR's merge commit |
| 58 | + if: ${{ inputs.pr_no != 0 }} |
| 59 | + working-directory: ${{github.workspace}} |
| 60 | + env: |
| 61 | + PR_NO: ${{ inputs.pr_no }} |
| 62 | + run: | |
| 63 | + git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/* |
| 64 | + git checkout origin/pr/${PR_NO}/merge |
| 65 | + git rev-parse origin/pr/${PR_NO}/merge |
| 66 | +
|
| 67 | + - name: Configure build |
| 68 | + run: > |
| 69 | + cmake |
| 70 | + -B ${{env.BUILD_DIR}} |
| 71 | + -DCMAKE_BUILD_TYPE=Release |
| 72 | + -DUMF_BUILD_SHARED_LIBRARY=ON |
| 73 | + -DUMF_BUILD_BENCHMARKS=ON |
| 74 | + -DUMF_BUILD_BENCHMARKS_MT=ON |
| 75 | + -DUMF_BUILD_TESTS=OFF |
| 76 | + -DUMF_FORMAT_CODE_STYLE=OFF |
| 77 | + -DUMF_DEVELOPER_MODE=OFF |
| 78 | + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON |
| 79 | + -DUMF_BUILD_CUDA_PROVIDER=ON |
| 80 | + -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON |
| 81 | + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON |
| 82 | +
|
| 83 | + - name: Build |
| 84 | + run: cmake --build ${{env.BUILD_DIR}} -j $(nproc) |
| 85 | + |
| 86 | + - name: Run benchmarks |
| 87 | + working-directory: ${{env.BUILD_DIR}} |
| 88 | + id: benchmarks |
| 89 | + run: numactl -N 1 ctest -V --test-dir benchmark -C Release |
| 90 | + |
| 91 | + - name: Add comment to PR |
| 92 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
| 93 | + if: ${{ always() && inputs.pr_no != 0 }} |
| 94 | + with: |
| 95 | + script: | |
| 96 | + let markdown = "" |
| 97 | + try { |
| 98 | + const fs = require('fs'); |
| 99 | + markdown = fs.readFileSync('umf_perf_results.md', 'utf8'); |
| 100 | + } catch(err) { |
| 101 | + } |
| 102 | +
|
| 103 | + const pr_no = '${{ inputs.pr_no }}'; |
| 104 | + const provider = 'LEVEL_ZERO'; |
| 105 | + const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; |
| 106 | + const test_status = '${{ steps.benchmarks.outcome }}'; |
| 107 | + const job_status = '${{ job.status }}'; |
| 108 | + const body = `Performance workflow for ${provider}_PROVIDER run:\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`; |
| 109 | +
|
| 110 | + github.rest.issues.createComment({ |
| 111 | + issue_number: pr_no, |
| 112 | + owner: context.repo.owner, |
| 113 | + repo: context.repo.repo, |
| 114 | + body: body |
| 115 | + }) |
0 commit comments