Skip to content

Commit 0194cd7

Browse files
add template for Windows benchmarks
problems with adding comments to PR to be fixed add workflow for running UMF benchmarks on Ubuntu download scripts for data visualisation from UR repository, run UMF benchmarks, upload the results to GitHub pages
1 parent 42adf1e commit 0194cd7

File tree

4 files changed

+201
-58
lines changed

4 files changed

+201
-58
lines changed

.github/workflows/nightly.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
permissions:
1111
contents: read
12+
pull-requests: write
1213

1314
jobs:
1415
fuzz-test:
@@ -194,3 +195,10 @@ jobs:
194195
# Beside the 2 LTS Ubuntu, we also test this on the latest Ubuntu - to be updated
195196
# every 6 months, so we verify the latest version of packages (compilers, etc.).
196197
os: "['ubuntu-22.04', 'ubuntu-24.04', 'ubuntu-24.10']"
198+
199+
Benchmarks:
200+
uses: ./.github/workflows/reusable_benchmarks.yml
201+
with:
202+
pr_no: '0'
203+
bench_script_params: ''
204+
upload_report: true

.github/workflows/pr_push.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ concurrency:
1414

1515
permissions:
1616
contents: read
17-
17+
pull-requests: write
18+
1819
jobs:
1920
CodeChecks:
2021
uses: ./.github/workflows/reusable_checks.yml
@@ -57,6 +58,10 @@ jobs:
5758
Benchmarks:
5859
needs: [Build]
5960
uses: ./.github/workflows/reusable_benchmarks.yml
61+
with:
62+
pr_no: '0'
63+
bench_script_params: ''
64+
upload_report: true
6065
ProxyLib:
6166
needs: [Build]
6267
uses: ./.github/workflows/reusable_proxy_lib.yml
Lines changed: 173 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
# Executes benchmarks implemented in this repository
22
name: Benchmarks
33

4-
on: workflow_call
4+
on:
5+
workflow_call:
6+
inputs:
7+
pr_no:
8+
required: true
9+
# even though this is a number, this is a workaround for issues with
10+
# reusable workflow calls that result in "Unexpected value '0'" error.
11+
type: string
12+
default: '0'
13+
bench_script_params:
14+
required: false
15+
type: string
16+
default: ''
17+
upload_report:
18+
required: false
19+
type: boolean
20+
default: false
521

622
permissions:
723
contents: read
24+
pull-requests: write
825

926
env:
1027
BUILD_DIR : "${{github.workspace}}/build"
@@ -13,68 +30,167 @@ env:
1330
jobs:
1431
benchmarks:
1532
name: Benchmarks
16-
env:
17-
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
33+
# env:
34+
# VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
1835
strategy:
1936
matrix:
20-
os: ['ubuntu-latest', 'windows-latest']
37+
os: ['ubuntu-latest'] #, 'windows-latest']
2138
include:
2239
# Windows doesn't recognize 'CMAKE_BUILD_TYPE', it uses '--config' param in build command to determine the build type
2340
- os: ubuntu-latest
2441
extra_build_option: '-DCMAKE_BUILD_TYPE=Release'
2542
runs-on: ${{matrix.os}}
2643

2744
steps:
28-
- name: Checkout
29-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
30-
with:
31-
fetch-depth: 0
32-
33-
- name: Install apt packages
34-
if: matrix.os == 'ubuntu-latest'
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install -y cmake libhwloc-dev libnuma-dev libtbb-dev
38-
39-
- name: Initialize vcpkg
40-
if: matrix.os == 'windows-latest'
41-
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
42-
with:
43-
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
44-
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
45-
vcpkgJsonGlob: '**/vcpkg.json'
46-
47-
- name: Install vcpkg packages
48-
if: matrix.os == 'windows-latest'
49-
run: vcpkg install
50-
shell: pwsh # Specifies PowerShell as the shell for running the script.
51-
52-
- name: Configure build
53-
run: >
54-
cmake
55-
-B ${{env.BUILD_DIR}}
56-
${{matrix.extra_build_option}}
57-
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
58-
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
59-
-DUMF_BUILD_SHARED_LIBRARY=ON
60-
-DUMF_BUILD_BENCHMARKS=ON
61-
-DUMF_BUILD_BENCHMARKS_MT=ON
62-
-DUMF_BUILD_TESTS=OFF
63-
-DUMF_FORMAT_CODE_STYLE=OFF
64-
-DUMF_DEVELOPER_MODE=OFF
65-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
66-
-DUMF_BUILD_CUDA_PROVIDER=ON
67-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
68-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
69-
70-
- name: Build UMF on Linux
71-
if: matrix.os == 'ubuntu-latest'
72-
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)
73-
74-
- name: Build UMF on Windows
75-
if: matrix.os == 'windows-latest'
76-
run: cmake --build ${{env.BUILD_DIR}} --config Release -j $Env:NUMBER_OF_PROCESSORS
77-
78-
- name: Run benchmarks
79-
working-directory: ${{env.BUILD_DIR}}
80-
run: ctest -V --test-dir benchmark -C Release
45+
- name: Add comment to PR
46+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
47+
if: ${{ always() && inputs.pr_no != 0 }}
48+
with:
49+
script: |
50+
const pr_no = '${{ inputs.pr_no }}';
51+
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
52+
const params = '${{ inputs.bench_script_params }}';
53+
const body = `Compute Benchmarks run (with params: ${params}):\n${url}`;
54+
55+
github.rest.issues.createComment({
56+
issue_number: pr_no,
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
body: body
60+
})
61+
62+
- name: Checkout
63+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
with:
65+
fetch-depth: 0
66+
67+
# We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
68+
- name: Fetch PR's merge commit
69+
if: ${{ inputs.pr_no != 0 }}
70+
env:
71+
PR_NO: ${{ inputs.pr_no }}
72+
run: |
73+
git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/*
74+
git checkout origin/pr/${PR_NO}/merge
75+
git rev-parse origin/pr/${PR_NO}/merge
76+
77+
- name: Install apt packages
78+
if: matrix.os == 'ubuntu-latest'
79+
run: |
80+
sudo apt-get update
81+
sudo apt-get install -y cmake libhwloc-dev libnuma-dev libtbb-dev
82+
83+
# - name: Initialize vcpkg
84+
# if: matrix.os == 'windows-latest'
85+
# uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
86+
# with:
87+
# vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
88+
# vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
89+
# vcpkgJsonGlob: '**/vcpkg.json'
90+
91+
# - name: Install vcpkg packages
92+
# if: matrix.os == 'windows-latest'
93+
# run: vcpkg install
94+
# shell: pwsh # Specifies PowerShell as the shell for running the script.
95+
96+
# -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
97+
- name: Configure build
98+
run: >
99+
cmake
100+
-B ${{env.BUILD_DIR}}
101+
${{matrix.extra_build_option}}
102+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
103+
-DUMF_BUILD_SHARED_LIBRARY=ON
104+
-DUMF_BUILD_BENCHMARKS=ON
105+
-DUMF_BUILD_BENCHMARKS_MT=ON
106+
-DUMF_BUILD_TESTS=OFF
107+
-DUMF_FORMAT_CODE_STYLE=OFF
108+
-DUMF_DEVELOPER_MODE=OFF
109+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
110+
-DUMF_BUILD_CUDA_PROVIDER=ON
111+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
112+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
113+
114+
- name: Build UMF on Linux
115+
if: matrix.os == 'ubuntu-latest'
116+
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)
117+
118+
# - name: Build UMF on Windows
119+
# if: matrix.os == 'windows-latest'
120+
# run: cmake --build ${{env.BUILD_DIR}} --config Release -j $Env:NUMBER_OF_PROCESSORS
121+
122+
- name: Checkout UR
123+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
124+
with:
125+
repository: oneapi-src/unified-runtime
126+
path: ur-repo
127+
fetch-depth: 1
128+
fetch-tags: false
129+
130+
- name: Install pip packages
131+
run: |
132+
pip install --force-reinstall -r ${{github.workspace}}/ur-repo/third_party/benchmark_requirements.txt
133+
134+
- name: Install HWLOC
135+
if: matrix.os == 'ubuntu-latest'
136+
run: |
137+
sudo apt-get update
138+
sudo apt-get install libhwloc-dev
139+
140+
- name: Run benchmarks
141+
id: benchmarks
142+
if: matrix.os == 'ubuntu-latest'
143+
working-directory: ${{env.BUILD_DIR}}
144+
run: >
145+
${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
146+
~/bench_workdir
147+
--umf ${{env.BUILD_DIR}}
148+
${{ inputs.upload_report && '--output-html' || '' }}
149+
${{ inputs.bench_script_params }}
150+
151+
- name: Test output
152+
run: >
153+
echo 'out: ${{ steps.benchmarks.outcome }}'
154+
155+
# - name: Run benchmarks
156+
# if: matrix.os == 'windows-latest'
157+
# working-directory: ${{env.BUILD_DIR}}
158+
# run: >
159+
# python3 ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
160+
# ~/bench_workdir
161+
# --umf ${{env.BUILD_DIR}}
162+
# ${{ inputs.upload_report && '--output-html' || '' }}
163+
# ${{ inputs.bench_script_params }}
164+
165+
- name: Add comment to PR
166+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
167+
if: ${{ always() && inputs.pr_no != 0 }}
168+
with:
169+
script: |
170+
let markdown = ""
171+
try {
172+
const fs = require('fs');
173+
markdown = fs.readFileSync('${{env.BUILD_DIR}}/benchmark_results.md', 'utf8');
174+
} catch(err) {
175+
}
176+
177+
const pr_no = '${{ inputs.pr_no }}';
178+
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
179+
const test_status = '${{ steps.benchmarks.outcome }}';
180+
const job_status = '${{ job.status }}';
181+
const params = '${{ inputs.bench_script_params }}';
182+
const body = `Compute Benchmarks run (${params}):\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`;
183+
184+
github.rest.issues.createComment({
185+
issue_number: pr_no,
186+
owner: context.repo.owner,
187+
repo: context.repo.repo,
188+
body: body
189+
})
190+
191+
- name: Upload HTML report
192+
if: ${{ always() && inputs.upload_report }}
193+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
194+
with:
195+
path: ${{env.BUILD_DIR}}/benchmark_results.html
196+
key: benchmark-results-${{ github.run_id }}

.github/workflows/reusable_docs_build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ jobs:
4545
-DUMF_DISABLE_HWLOC=ON
4646
cmake --build build --target docs
4747
48+
- name: Download benchmark HTML
49+
if: ${{ inputs.upload == true }}
50+
id: download-bench-html
51+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
52+
with:
53+
path: ${{github.workspace}}/build/benchmark_results.html
54+
key: benchmark-results-
55+
56+
- name: Move benchmark HTML
57+
if: ${{ inputs.upload == true && steps.download-bench-html.outputs.cache-hit != '' }}
58+
# exact or partial cache hit
59+
run: |
60+
mv ${{ github.workspace }}/build/benchmark_results.html ${{ github.workspace }}/build/docs_build/generated/html
61+
4862
- name: Upload artifact
4963
if: ${{ inputs.upload == true }}
5064
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0

0 commit comments

Comments
 (0)