-
Notifications
You must be signed in to change notification settings - Fork 3
240 lines (219 loc) · 8.68 KB
/
Copy pathtests.yml
File metadata and controls
240 lines (219 loc) · 8.68 KB
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
name: Unit Tests
on:
push:
branches: [main, dev]
pull_request:
issue_comment:
types: [created]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
issues: write
env:
BUILD_TYPE: Release
DEPS_CACHE: /tmp/sofieblas-cmake-deps
jobs:
cpu-tests:
name: CPU Unit Tests
if: |
github.event_name != 'issue_comment' ||
(
github.event.issue.pull_request != null &&
!startsWith(github.event.comment.body, '/runtest') &&
!startsWith(github.event.comment.body, '/runbenchmark')
)
concurrency:
group: cpu-tests-${{ github.event.issue.number || github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/merge', github.event.issue.number) || github.ref }}
- name: Install OpenBLAS
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: ${{ env.DEPS_CACHE }}
key: cmake-deps-cpu-${{ hashFiles('cmake/SofieBLASBackends.cmake') }}
restore-keys: cmake-deps-cpu-
- name: Configure
run: |
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSOFIEBLAS_BUILD_TESTS=ON \
-DSOFIEBLAS_BUILD_BENCHMARKS=ON \
-DSOFIEBLAS_ENABLE_CUDA=OFF \
-DSOFIEBLAS_ENABLE_HIP=OFF \
"-DFETCHCONTENT_BASE_DIR=${{ env.DEPS_CACHE }}"
- name: Build
run: cmake --build build -j"$(nproc)"
- name: Run tests
working-directory: build
run: ctest --output-on-failure -j"$(nproc)" -R '\.cpu(\.|$)'
- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: cpu-test-log-${{ github.run_id }}
path: build/Testing/Temporary/LastTest.log
if-no-files-found: ignore
parse-command:
name: Parse trigger
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
contains(fromJSON('["sanjibansg","lmoneta"]'), github.event.comment.user.login) &&
startsWith(github.event.comment.body, '/runtest')
)
outputs:
runner_label: ${{ steps.parse.outputs.runner_label }}
valid: ${{ steps.parse.outputs.valid }}
flavor: ${{ steps.parse.outputs.flavor }}
valid_flavors: ${{ steps.parse.outputs.valid_flavors }}
backend: ${{ steps.parse.outputs.backend }}
steps:
- name: React to trigger comment
if: github.event_name == 'issue_comment'
uses: actions/github-script@v7
with:
script: |
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'eyes'
});
- name: Parse runner flavor
id: parse
uses: actions/github-script@v7
with:
script: |
const flavors = {
l40s: { runner: 'ml4ep-l40s', backend: 'cuda' },
h100: { runner: 'ml4ep-h100', backend: 'cuda' },
'h100-47gb': { runner: 'ml4ep-h100-47gb', backend: 'cuda' },
w7900: { runner: 'ml4ep-w7900', backend: 'hip' },
mi300x: { runner: 'ml4ep-mi300x', backend: 'hip' },
};
let flavor = 'l40s';
let valid = true;
if (context.eventName === 'issue_comment') {
const m = context.payload.comment.body.trim().match(/^\/runtest(?:\s+(\S+))?/i);
if (m && m[1]) {
flavor = m[1].toLowerCase();
valid = Object.prototype.hasOwnProperty.call(flavors, flavor);
}
}
core.setOutput('flavor', flavor);
core.setOutput('valid', String(valid));
core.setOutput('runner_label', valid ? flavors[flavor].runner : '');
core.setOutput('backend', valid ? flavors[flavor].backend : '');
core.setOutput('valid_flavors', Object.keys(flavors).join(', '));
- name: Post run link
if: github.event_name == 'issue_comment'
uses: actions/github-script@v7
with:
script: |
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: `\`/runtest\` (${{ steps.parse.outputs.flavor }}): triggered - [view run](${runUrl})`
});
gpu-tests:
name: GPU Unit Tests
needs: parse-command
if: needs.parse-command.outputs.valid == 'true'
concurrency:
group: gpu-tests-${{ needs.parse-command.outputs.flavor }}-${{ github.event.issue.number || github.ref }}
cancel-in-progress: true
runs-on: ${{ needs.parse-command.outputs.runner_label }}
container:
image: registry.cern.ch/ngt/lxplus-like:9
options: --user 0:0
timeout-minutes: 45
steps:
- name: GPU check (NVIDIA)
if: needs.parse-command.outputs.backend == 'cuda'
run: nvidia-smi
- name: GPU check (AMD)
if: needs.parse-command.outputs.backend == 'hip'
run: rocm-smi
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/merge', github.event.issue.number) || github.ref }}
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: ${{ env.DEPS_CACHE }}
key: cmake-deps-gpu-${{ needs.parse-command.outputs.backend }}-${{ hashFiles('cmake/SofieBLASBackends.cmake') }}
restore-keys: cmake-deps-gpu-${{ needs.parse-command.outputs.backend }}-
- name: Configure
env:
BACKEND: ${{ needs.parse-command.outputs.backend }}
run: |
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSOFIEBLAS_BUILD_TESTS=ON \
-DSOFIEBLAS_BUILD_BENCHMARKS=ON \
-DCMAKE_CUDA_ARCHITECTURES=native \
-DCMAKE_HIP_ARCHITECTURES=native \
"-DSOFIEBLAS_ENABLE_CUDA=$([ "$BACKEND" = "cuda" ] && echo ON || echo OFF)" \
"-DSOFIEBLAS_ENABLE_HIP=$([ "$BACKEND" = "hip" ] && echo ON || echo OFF)" \
"-DFETCHCONTENT_BASE_DIR=${{ env.DEPS_CACHE }}"
- name: Build
run: cmake --build build -j"$(nproc)"
- name: Run GPU tests
working-directory: build
run: ctest --output-on-failure -j"$(nproc)" -R "\.${{ needs.parse-command.outputs.backend }}(\.|\$)"
- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: gpu-test-log-${{ github.run_id }}
path: build/Testing/Temporary/LastTest.log
if-no-files-found: ignore
- name: Report result on PR
if: always() && github.event_name == 'issue_comment'
uses: actions/github-script@v7
with:
script: |
const status = '${{ job.status }}' === 'success' ? '✅ passed' : '❌ failed';
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: `\`/runtest\` (${{ needs.parse-command.outputs.flavor }}): GPU Unit Tests ${status} - [view run](${runUrl})`
});
report-invalid-flavor:
name: Report invalid runner flavor
needs: parse-command
runs-on: ubuntu-latest
if: >-
always() && github.event_name == 'issue_comment' &&
needs.parse-command.result == 'success' &&
needs.parse-command.outputs.valid == 'false'
steps:
- uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: `\`/runtest\`: unknown runner flavor \`${{ needs.parse-command.outputs.flavor }}\`. ` +
`Valid options: ${{ needs.parse-command.outputs.valid_flavors }} (or omit for the default, l40s).`
});