Repository navigation
240 lines (202 loc) · 8.23 KB
/
Copy pathprofile.yml
File metadata and controls
240 lines (202 loc) · 8.23 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: Profile
# Measures why the tests take longer on one platform than another. Not part of
# CI, and it never starts by itself: run it by hand (Actions -> Profile -> Run
# workflow, or `gh workflow run profile.yml --ref <branch>`). GitHub only
# offers that for a workflow file that is on the default branch.
#
# To have it run on a pull request again while investigating, add back:
#
# pull_request:
# paths:
# - ".github/workflows/profile.yml"
# - "scripts/ci_profiling/**"
#
# Each platform uploads a `probes-<platform>` artifact (the micro-probes, a
# few minutes) and a `profile-<platform>` one; compare them with
# scripts/ci_profiling/compare.py (see its docstring).
on:
workflow_dispatch:
inputs:
tests:
description: "Test files to profile (space separated)"
default: >-
tests/render/test_render_plane_gizmo.py
tests/render/test_multiscale_level_alignment.py
tests/render/test_plane_planning.py
full_suite:
description: "Also run the whole suite as CI does, with per-test times"
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Minutes, not tens of minutes: the micro-probes alone, so their numbers are
# in before the profile job below is done. Uploads `probes-<platform>`.
probes:
name: probes ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
env:
# As in ci.yml.
WGPU_BACKEND_TYPE: ${{ matrix.platform == 'windows-latest' && 'Vulkan' || '' }}
SPATIAL_GRAPH_NO_PREBUILT: "1"
OUT: probes_out
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7
# The environment below is ci.yml's, step for step, so the numbers are
# the ones CI sees.
- name: Set up headless GUI
uses: pyvista/setup-headless-display-action@v5
with:
qt: true
- name: Install llvmpipe and lavapipe for offscreen canvas
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update -y -qq
sudo apt install -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Install lavapipe for offscreen canvas
if: matrix.platform == 'windows-latest'
uses: jakoch/install-vulkan-sdk-action@v1
with:
install_lavapipe: true
stripdown: true
cache: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
cache-dependency-path: "pyproject.toml"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install -U pip
python -m pip install .[test,pyside,remote,anywidget,examples,graph]
- name: Machine
run: |
mkdir -p "$OUT"
python -c "from pygfx.renderers.wgpu import get_shared; print('adapter:', get_shared().device.adapter.summary)"
python scripts/ci_profiling/machine_info.py | tee "$OUT/machine_info.txt"
# No cellier code involved in the first three.
- name: Probe - file writes
if: always()
run: python scripts/ci_profiling/probe_file_io.py --out "$OUT/probe_file_io.json"
- name: Probe - frame time
if: always()
run: python scripts/ci_profiling/probe_render.py --thread-sweep default,1,2,4 --out "$OUT/probe_render.json"
- name: Probe - single wgpu calls
if: always()
run: python scripts/ci_profiling/probe_gpu_calls.py --out "$OUT/probe_gpu_calls.json"
# Reads the datasets of two test files through cellier's stores.
- name: Probe - brick reads
if: always()
run: python scripts/ci_profiling/probe_chunk_read.py --out "$OUT/probe_chunk_read.json"
- name: Upload
if: always()
uses: actions/upload-artifact@v7
with:
name: probes-${{ matrix.platform }}
path: ${{ env.OUT }}
if-no-files-found: error
profile:
name: profile ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
env:
# As in ci.yml.
WGPU_BACKEND_TYPE: ${{ matrix.platform == 'windows-latest' && 'Vulkan' || '' }}
SPATIAL_GRAPH_NO_PREBUILT: "1"
DEFAULT_TESTS: >-
tests/render/test_render_plane_gizmo.py
tests/render/test_multiscale_level_alignment.py
tests/render/test_plane_planning.py
INPUT_TESTS: ${{ inputs.tests }}
OUT: profile_out
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7
# The environment below is ci.yml's, step for step, so the numbers are
# the ones CI sees.
- name: Set up headless GUI
uses: pyvista/setup-headless-display-action@v5
with:
qt: true
- name: Install llvmpipe and lavapipe for offscreen canvas
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update -y -qq
sudo apt install -y libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Install lavapipe for offscreen canvas
if: matrix.platform == 'windows-latest'
uses: jakoch/install-vulkan-sdk-action@v1
with:
install_lavapipe: true
stripdown: true
cache: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
cache-dependency-path: "pyproject.toml"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install -U pip
python -m pip install .[test,pyside,remote,anywidget,examples,graph]
- name: Machine
run: |
mkdir -p "$OUT/junit" "$OUT/prof"
echo "TESTS=${INPUT_TESTS:-$DEFAULT_TESTS}" >> "$GITHUB_ENV"
python -c "import os, platform, tempfile; print(platform.platform()); print('cpus:', os.cpu_count()); print('temp:', tempfile.gettempdir()); print('cwd:', os.getcwd())"
python -c "from pygfx.renderers.wgpu import get_shared; print('adapter:', get_shared().device.adapter.summary)"
python scripts/ci_profiling/machine_info.py
# --- cProfile of each test file ---------------------------------------
# Also warms every cache, so the timed runs below start equal.
- name: cProfile each test file
if: always()
run: |
for test in $TESTS; do
name=$(basename "$test" .py)
echo "::group::$name"
python -m cProfile -o "$OUT/prof/$name.prof" -m pytest "$test" -q --durations=10 || true
echo "::endgroup::"
done
# --- The same test files, one thing changed at a time -----------------
- name: Timed - baseline (no coverage)
if: always()
run: pytest $TESTS -q --junitxml="$OUT/junit/baseline.xml" || true
- name: Timed - with coverage
if: always()
run: pytest $TESTS -q --cov --cov-report= --junitxml="$OUT/junit/coverage.xml" || true
# pytest's tmp_path is under the system temp directory, which on the
# Windows runner is on C:; the workspace is on another drive.
- name: Timed - tmp_path on the workspace drive
if: always()
run: pytest $TESTS -q --basetemp="${{ github.workspace }}/.pytest_basetemp" --junitxml="$OUT/junit/basetemp_workspace.xml" || true
- name: Timed - llvmpipe on one thread
if: always() && matrix.platform != 'macos-latest'
env:
LP_NUM_THREADS: "1"
run: pytest $TESTS -q --junitxml="$OUT/junit/lp_threads_1.xml" || true
# --- The whole suite, as CI runs it, with every test's time -----------
- name: Timed - full suite as CI
if: always() && (github.event_name != 'workflow_dispatch' || inputs.full_suite)
run: pytest --color=yes --durations=50 --cov --cov-report= --junitxml="$OUT/junit/full.xml" || true
- name: Upload
if: always()
uses: actions/upload-artifact@v7
with:
name: profile-${{ matrix.platform }}
path: ${{ env.OUT }}
if-no-files-found: error