-
Notifications
You must be signed in to change notification settings - Fork 120
243 lines (215 loc) · 7.99 KB
/
benchmarks-reusable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: Benchmarks Reusable
on:
workflow_call:
inputs:
str_name:
required: true
type: string
unit:
required: true
type: string
pr_no:
required: true
# even though this is a number, this is a workaround for issues with
# reusable workflow calls that result in "Unexpected value '0'" error.
type: string
bench_script_params:
required: false
type: string
default: ''
sycl_config_params:
required: false
type: string
default: ''
sycl_repo:
required: true
type: string
default: 'intel/llvm'
sycl_commit:
required: false
type: string
default: ''
upload_report:
required: false
type: boolean
default: false
permissions:
contents: read
pull-requests: write
jobs:
e2e-build-hw:
name: Build SYCL, UR, run Compute Benchmarks
strategy:
matrix:
adapter: [
{str_name: "${{ inputs.str_name }}",
sycl_config: "${{ inputs.sycl_config_params }}",
unit: "${{ inputs.unit }}"
}
]
build_type: [Release]
compiler: [{c: clang, cxx: clang++}]
runs-on: "${{ inputs.str_name }}_PERF"
steps:
- name: Cleanup self-hosted workspace
if: always()
run: |
ls -la ./
rm -rf ./* || true
- name: Add comment to PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ always() && inputs.pr_no != 0 }}
with:
script: |
const pr_no = '${{ inputs.pr_no }}';
const adapter = '${{ matrix.adapter.str_name }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const params = '${{ inputs.bench_script_params }}';
const body = `Compute Benchmarks ${adapter} run (with params: ${params}):\n${url}`;
github.rest.issues.createComment({
issue_number: pr_no,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Checkout UR
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ur-repo
- name: Install pip packages
run: |
pip install --force-reinstall -r ${{github.workspace}}/ur-repo/third_party/benchmark_requirements.txt
# We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
- name: Fetch PR's merge commit
if: ${{ inputs.pr_no != 0 }}
working-directory: ${{github.workspace}}/ur-repo
env:
PR_NO: ${{ inputs.pr_no }}
run: |
git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/*
git checkout origin/pr/${PR_NO}/merge
git rev-parse origin/pr/${PR_NO}/merge
- name: Checkout SYCL
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: ${{inputs.sycl_repo}}
ref: refs/heads/sycl
path: sycl-repo
fetch-depth: 1
fetch-tags: false
- name: Fetch specific SYCL commit
if: inputs.sycl_commit != ''
working-directory: ./sycl-repo
run: |
git fetch --depth=1 origin ${{ inputs.sycl_commit }}
git checkout ${{ inputs.sycl_commit }}
- name: Set CUDA env vars
if: matrix.adapter.str_name == 'cuda'
run: |
echo "CUDA_LIB_PATH=/usr/local/cuda/lib64/stubs" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Configure SYCL
run: >
python3 sycl-repo/buildbot/configure.py
-t ${{matrix.build_type}}
-o ${{github.workspace}}/sycl_build
--cmake-gen "Ninja"
--ci-defaults ${{matrix.adapter.sycl_config}}
--cmake-opt="-DLLVM_INSTALL_UTILS=ON"
--cmake-opt="-DSYCL_PI_TESTS=OFF"
--cmake-opt="-DSYCL_UR_USE_FETCH_CONTENT=OFF"
--cmake-opt="-DSYCL_UR_SOURCE_DIR=${{github.workspace}}/ur-repo/"
--cmake-opt=-DCMAKE_C_COMPILER_LAUNCHER=ccache
--cmake-opt=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build SYCL
run: cmake --build ${{github.workspace}}/sycl_build -j
- name: Configure UR
run: >
cmake -DCMAKE_BUILD_TYPE=Release
-S${{github.workspace}}/ur-repo
-B${{github.workspace}}/ur_build
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/ur_install
-DUR_BUILD_TESTS=OFF
-DUR_BUILD_ADAPTER_L0=ON
-DUR_BUILD_ADAPTER_L0_V2=ON
-DUMF_DISABLE_HWLOC=ON
- name: Build UR
run: cmake --build ${{github.workspace}}/ur_build -j $(nproc)
- name: Install UR
run: cmake --install ${{github.workspace}}/ur_build
- name: Checkout UMF
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: oneapi-src/unified-memory-framework
ref: main
path: umf-repo
fetch-depth: 1
fetch-tags: false
- name: Configure UMF
run: >
cmake -DCMAKE_BUILD_TYPE=Release
-S${{github.workspace}}/umf-repo
-B${{github.workspace}}/umf_build
-DUMF_BUILD_BENCHMARKS=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
- name: Build UMF
run: cmake --build ${{github.workspace}}/umf_build -j $(nproc)
- name: Compute core range
run: |
# Compute the core range for the first NUMA node, skipping the first 4 cores.
# This is to avoid the first cores that the kernel is likely to schedule more work on.
CORES=$(lscpu | awk '
/NUMA node0 CPU|On-line CPU/ {line=$0}
END {
split(line, a, " ")
split(a[4], b, ",")
sub(/^0/, "4", b[1])
print b[1]
}')
echo "CORES=$CORES" >> $GITHUB_ENV
- name: Run benchmarks
working-directory: ${{ github.workspace }}/ur-repo/
id: benchmarks
run: >
taskset -c ${{ env.CORES }} ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
~/bench_workdir
--sycl ${{ github.workspace }}/sycl_build
--ur ${{ github.workspace }}/ur_install
--umf ${{ github.workspace }}/umf_build
--adapter ${{ matrix.adapter.str_name }}
${{ inputs.upload_report && '--output-html' || '' }}
${{ inputs.bench_script_params }}
- name: Add comment to PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ always() && inputs.pr_no != 0 }}
with:
script: |
let markdown = ""
try {
const fs = require('fs');
markdown = fs.readFileSync('ur-repo/benchmark_results.md', 'utf8');
} catch(err) {
}
const pr_no = '${{ inputs.pr_no }}';
const adapter = '${{ matrix.adapter.str_name }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const test_status = '${{ steps.benchmarks.outcome }}';
const job_status = '${{ job.status }}';
const params = '${{ inputs.bench_script_params }}';
const body = `Compute Benchmarks ${adapter} run (${params}):\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`;
github.rest.issues.createComment({
issue_number: pr_no,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Upload HTML report
if: ${{ always() && inputs.upload_report }}
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ur-repo/benchmark_results.html
key: benchmark-results-${{ matrix.adapter.str_name }}-${{ github.run_id }}
- name: Get information about platform
if: ${{ always() }}
working-directory: ${{ github.workspace }}/ur-repo/
run: .github/scripts/get_system_info.sh