Skip to content

Commit ed398ec

Browse files
[CI] Add initial workflow for measuring performance
1 parent ddd572b commit ed398ec

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

.github/workflows/performance.yml

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

0 commit comments

Comments
 (0)