benchx 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- benchx-0.1.0/.github/workflows/docs.yml +62 -0
- benchx-0.1.0/.github/workflows/e2e.yml +418 -0
- benchx-0.1.0/.github/workflows/release.yml +122 -0
- benchx-0.1.0/.github/workflows/tests.yml +77 -0
- benchx-0.1.0/.gitignore +13 -0
- benchx-0.1.0/CHANGELOG.md +15 -0
- benchx-0.1.0/LICENSE +201 -0
- benchx-0.1.0/PKG-INFO +261 -0
- benchx-0.1.0/README.md +82 -0
- benchx-0.1.0/docs/benchx.md +239 -0
- benchx-0.1.0/docs/design/README.md +24 -0
- benchx-0.1.0/docs/design/benchmark-environments.md +253 -0
- benchx-0.1.0/docs/design/benchmark-result-schema.md +672 -0
- benchx-0.1.0/docs/design/comparator.md +238 -0
- benchx-0.1.0/docs/design/harness-adapter.md +334 -0
- benchx-0.1.0/docs/design/prototype-design.md +661 -0
- benchx-0.1.0/docs/design/prototype-scope.md +97 -0
- benchx-0.1.0/docs/design/runner-schema.md +299 -0
- benchx-0.1.0/docs/design/runner.md +157 -0
- benchx-0.1.0/docs/design/system-decomposition.md +373 -0
- benchx-0.1.0/docs/releasing.md +68 -0
- benchx-0.1.0/docs/requirements.txt +5 -0
- benchx-0.1.0/docs/use-cases/README.md +13 -0
- benchx-0.1.0/docs/use-cases/UC-01-short-slug.md +149 -0
- benchx-0.1.0/docs/use-cases/UC-02-variants.md +162 -0
- benchx-0.1.0/docs/use-cases/UC-03-compare.md +193 -0
- benchx-0.1.0/docs/use-cases/UC-04-cross-env.md +133 -0
- benchx-0.1.0/docs/use-cases/UC_NN_TEMPLATE.md +195 -0
- benchx-0.1.0/docs/user_stories/README.md +17 -0
- benchx-0.1.0/docs/user_stories/TEMPLATE.md +51 -0
- benchx-0.1.0/docs/user_stories/apache-arrow-local-benchmarking.md +258 -0
- benchx-0.1.0/docs/user_stories/apache-arrow.md +162 -0
- benchx-0.1.0/docs/user_stories/array-api-and-accelerators.md +98 -0
- benchx-0.1.0/docs/user_stories/narwhals.md +66 -0
- benchx-0.1.0/docs/user_stories/numpy.md +93 -0
- benchx-0.1.0/docs/user_stories/one-off.md +96 -0
- benchx-0.1.0/docs/user_stories/openblas_user_stories.md +82 -0
- benchx-0.1.0/docs/user_stories/pandas.md +72 -0
- benchx-0.1.0/pyproject.toml +47 -0
- benchx-0.1.0/src/benchx/__init__.py +9 -0
- benchx-0.1.0/src/benchx/adapters/__init__.py +10 -0
- benchx-0.1.0/src/benchx/adapters/asv.py +491 -0
- benchx-0.1.0/src/benchx/adapters/asv_runtime.py +326 -0
- benchx-0.1.0/src/benchx/adapters/base.py +143 -0
- benchx-0.1.0/src/benchx/adapters/benchx_params.py +77 -0
- benchx-0.1.0/src/benchx/adapters/gbench.py +217 -0
- benchx-0.1.0/src/benchx/adapters/pyperf.py +468 -0
- benchx-0.1.0/src/benchx/bench.py +113 -0
- benchx-0.1.0/src/benchx/cli.py +625 -0
- benchx-0.1.0/src/benchx/collectors.py +113 -0
- benchx-0.1.0/src/benchx/compare.py +398 -0
- benchx-0.1.0/src/benchx/config.py +193 -0
- benchx-0.1.0/src/benchx/core/__init__.py +70 -0
- benchx-0.1.0/src/benchx/core/catalog.py +97 -0
- benchx-0.1.0/src/benchx/core/errors.py +230 -0
- benchx-0.1.0/src/benchx/core/hashing.py +25 -0
- benchx-0.1.0/src/benchx/core/loader.py +99 -0
- benchx-0.1.0/src/benchx/core/rules.py +156 -0
- benchx-0.1.0/src/benchx/core/validation.py +59 -0
- benchx-0.1.0/src/benchx/errors.py +5 -0
- benchx-0.1.0/src/benchx/harnesses.py +158 -0
- benchx-0.1.0/src/benchx/identity.py +70 -0
- benchx-0.1.0/src/benchx/orders.py +68 -0
- benchx-0.1.0/src/benchx/parquet.py +111 -0
- benchx-0.1.0/src/benchx/projection.py +261 -0
- benchx-0.1.0/src/benchx/runner.py +328 -0
- benchx-0.1.0/src/benchx/schemas/comparison-document/0.1.0/examples/history.json +111 -0
- benchx-0.1.0/src/benchx/schemas/comparison-document/0.1.0/examples/run.json +117 -0
- benchx-0.1.0/src/benchx/schemas/comparison-document/0.1.0/schema.json +620 -0
- benchx-0.1.0/src/benchx/schemas/config/0.1.0/examples/google-benchmark-recommended.json +14 -0
- benchx-0.1.0/src/benchx/schemas/config/0.1.0/examples/pyperf-recommended.json +19 -0
- benchx-0.1.0/src/benchx/schemas/config/0.1.0/schema.json +103 -0
- benchx-0.1.0/src/benchx/schemas/env-identity/0.1.0/examples/arrow-laptop.json +12 -0
- benchx-0.1.0/src/benchx/schemas/env-identity/0.1.0/schema.json +74 -0
- benchx-0.1.0/src/benchx/schemas/environment-policy/0.1.0/examples/laptop-default.json +23 -0
- benchx-0.1.0/src/benchx/schemas/environment-policy/0.1.0/examples/tuned-node.json +35 -0
- benchx-0.1.0/src/benchx/schemas/environment-policy/0.1.0/schema.json +53 -0
- benchx-0.1.0/src/benchx/schemas/identity-policy/0.1.0/examples/arrow.json +28 -0
- benchx-0.1.0/src/benchx/schemas/identity-policy/0.1.0/examples/default.json +20 -0
- benchx-0.1.0/src/benchx/schemas/identity-policy/0.1.0/schema.json +55 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/examples/adhoc.json +104 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/examples/arrow-temperature.json +110 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/examples/arrow.json +157 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/examples/cupy-matmul-cpu-time.json +173 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/examples/cupy-matmul-gpu-time.json +173 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/examples/narwhals-overhead-ratio.json +107 -0
- benchx-0.1.0/src/benchx/schemas/measurement-result/0.1.0/schema.json +724 -0
- benchx-0.1.0/src/benchx/schemas/target-description/0.1.0/examples/arrow-hardened.json +15 -0
- benchx-0.1.0/src/benchx/schemas/target-description/0.1.0/examples/empty-text.json +11 -0
- benchx-0.1.0/src/benchx/schemas/target-description/0.1.0/examples/minimal.json +8 -0
- benchx-0.1.0/src/benchx/schemas/target-description/0.1.0/schema.json +84 -0
- benchx-0.1.0/src/benchx/schemas/target-provider-request/0.1.0/examples/describe.json +5 -0
- benchx-0.1.0/src/benchx/schemas/target-provider-request/0.1.0/examples/prepare.json +6 -0
- benchx-0.1.0/src/benchx/schemas/target-provider-request/0.1.0/schema.json +23 -0
- benchx-0.1.0/src/benchx/schemas/work-order/0.1.0/examples/adhoc-minimal.json +21 -0
- benchx-0.1.0/src/benchx/schemas/work-order/0.1.0/examples/arrow-laptop.json +40 -0
- benchx-0.1.0/src/benchx/schemas/work-order/0.1.0/examples/draft.json +18 -0
- benchx-0.1.0/src/benchx/schemas/work-order/0.1.0/schema.json +406 -0
- benchx-0.1.0/src/benchx/session.py +293 -0
- benchx-0.1.0/src/benchx/snapshot.py +297 -0
- benchx-0.1.0/src/benchx/store.py +323 -0
- benchx-0.1.0/src/benchx/target.py +117 -0
- benchx-0.1.0/tests/conftest.py +182 -0
- benchx-0.1.0/tests/fake_gbench.py +73 -0
- benchx-0.1.0/tests/fixtures/pyperf-calibrated.json +155 -0
- benchx-0.1.0/tests/fixtures/pyperf-native.json +68 -0
- benchx-0.1.0/tests/test_asv.py +421 -0
- benchx-0.1.0/tests/test_bench.py +227 -0
- benchx-0.1.0/tests/test_bench_harnesses.py +275 -0
- benchx-0.1.0/tests/test_benchmark_source.py +157 -0
- benchx-0.1.0/tests/test_build_import_path.py +122 -0
- benchx-0.1.0/tests/test_collectors.py +213 -0
- benchx-0.1.0/tests/test_comparator.py +359 -0
- benchx-0.1.0/tests/test_compare_harnesses.py +167 -0
- benchx-0.1.0/tests/test_config.py +181 -0
- benchx-0.1.0/tests/test_config_schema.py +116 -0
- benchx-0.1.0/tests/test_discovery_timeout.py +148 -0
- benchx-0.1.0/tests/test_e2e_numpy_revisions.py +276 -0
- benchx-0.1.0/tests/test_harnesses.py +66 -0
- benchx-0.1.0/tests/test_loader.py +103 -0
- benchx-0.1.0/tests/test_orders.py +58 -0
- benchx-0.1.0/tests/test_params.py +88 -0
- benchx-0.1.0/tests/test_pipeline.py +77 -0
- benchx-0.1.0/tests/test_projection.py +145 -0
- benchx-0.1.0/tests/test_prototype.py +669 -0
- benchx-0.1.0/tests/test_pyperf.py +502 -0
- benchx-0.1.0/tests/test_rules.py +160 -0
- benchx-0.1.0/tests/test_session.py +152 -0
- benchx-0.1.0/tests/test_sides.py +159 -0
- benchx-0.1.0/tests/test_target.py +216 -0
- benchx-0.1.0/tests/test_uc04.py +132 -0
- benchx-0.1.0/tests/test_validate.py +83 -0
- benchx-0.1.0/tests/test_validation.py +260 -0
- benchx-0.1.0/tools/gen_docs.py +532 -0
- benchx-0.1.0/uv.lock +533 -0
- benchx-0.1.0/zensical.toml +123 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- "docs/**"
|
|
8
|
+
- "src/benchx/schemas/**"
|
|
9
|
+
- "tools/gen_docs.py"
|
|
10
|
+
- "zensical.toml"
|
|
11
|
+
- "README.md"
|
|
12
|
+
- ".github/workflows/docs.yml"
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [main]
|
|
15
|
+
paths:
|
|
16
|
+
- "docs/**"
|
|
17
|
+
- "src/benchx/schemas/**"
|
|
18
|
+
- "tools/gen_docs.py"
|
|
19
|
+
- "zensical.toml"
|
|
20
|
+
- "README.md"
|
|
21
|
+
- ".github/workflows/docs.yml"
|
|
22
|
+
|
|
23
|
+
concurrency:
|
|
24
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
25
|
+
cancel-in-progress: true
|
|
26
|
+
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
build:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- uses: astral-sh/setup-uv@v5
|
|
37
|
+
|
|
38
|
+
- name: Generate derived pages (landing page, benchx page, schema reference)
|
|
39
|
+
run: uv run --python 3.12 --with-requirements docs/requirements.txt python tools/gen_docs.py
|
|
40
|
+
|
|
41
|
+
- name: Build site
|
|
42
|
+
run: uv run --python 3.12 --with-requirements docs/requirements.txt zensical build --strict --clean
|
|
43
|
+
|
|
44
|
+
- uses: actions/upload-pages-artifact@v3
|
|
45
|
+
with:
|
|
46
|
+
path: site
|
|
47
|
+
|
|
48
|
+
deploy:
|
|
49
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
50
|
+
needs: build
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
permissions:
|
|
53
|
+
pages: write
|
|
54
|
+
id-token: write
|
|
55
|
+
environment:
|
|
56
|
+
name: github-pages
|
|
57
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/configure-pages@v5
|
|
60
|
+
|
|
61
|
+
- id: deployment
|
|
62
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
name: e2e examples
|
|
2
|
+
|
|
3
|
+
# Runs examples from benchx-dev/benchx_examples and prints their output. Five jobs:
|
|
4
|
+
#
|
|
5
|
+
# numpy-spin builds NumPy with spin and benchmarks it:
|
|
6
|
+
# track.sh several revisions, each built and benchmarked
|
|
7
|
+
# num_threads.sh one prebuilt revision at several OPENBLAS_NUM_THREADS
|
|
8
|
+
# arrow builds a small Google Benchmark suite with CMake and compares the builds:
|
|
9
|
+
# examples/arrow/demo/run.sh
|
|
10
|
+
# examples/arrow/archery-local/run.sh
|
|
11
|
+
# pyperf-suite runs a suite of Python functions with `bx bench`:
|
|
12
|
+
# examples/pyperf-suite/run.sh
|
|
13
|
+
# matmul-params runs one parametrized benchmark, numpy and torch at three sizes, with
|
|
14
|
+
# `bx bench`; the quick version from the example's README:
|
|
15
|
+
# examples/matmul-params
|
|
16
|
+
# numpy-venvs measures the same benchmarks under two numpy versions, each in its own venv,
|
|
17
|
+
# with a `bx bench` call per side and round, and compares them:
|
|
18
|
+
# examples/numpy-venvs/run.sh
|
|
19
|
+
#
|
|
20
|
+
# Nothing is checked. The job fails only if a step fails (a clone, a build, a script that
|
|
21
|
+
# crashes); the scripts exit 0 even when a revision fails, so read the printed output.
|
|
22
|
+
#
|
|
23
|
+
# Runs on every pull request, and on demand. A run on demand can take another
|
|
24
|
+
# benchx_examples branch, tag or commit (examples_ref), which a pull request here cannot:
|
|
25
|
+
# the examples live in another repository.
|
|
26
|
+
#
|
|
27
|
+
# In the numpy-spin job the benchmarks are pinned to two cores (BENCH_CPUS). num_threads.sh
|
|
28
|
+
# should use 1, 2 and 4 threads, so that the last of them oversubscribes the two cores. The
|
|
29
|
+
# NumPy builds are not pinned.
|
|
30
|
+
#
|
|
31
|
+
on:
|
|
32
|
+
workflow_dispatch:
|
|
33
|
+
inputs:
|
|
34
|
+
examples_ref:
|
|
35
|
+
description: "benchx_examples branch, tag or commit to run"
|
|
36
|
+
default: main
|
|
37
|
+
pull_request:
|
|
38
|
+
|
|
39
|
+
concurrency:
|
|
40
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
41
|
+
cancel-in-progress: true
|
|
42
|
+
|
|
43
|
+
permissions:
|
|
44
|
+
contents: read
|
|
45
|
+
|
|
46
|
+
jobs:
|
|
47
|
+
numpy-spin:
|
|
48
|
+
name: numpy-spin (track.sh, num_threads.sh)
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
timeout-minutes: 150
|
|
51
|
+
env:
|
|
52
|
+
NUMPY: ${{ github.workspace }}/numpy
|
|
53
|
+
EXAMPLE: ${{ github.workspace }}/benchx_examples/examples/numpy-spin
|
|
54
|
+
BENCH_CPUS: "0,1"
|
|
55
|
+
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
56
|
+
CCACHE_MAXSIZE: 500M
|
|
57
|
+
steps:
|
|
58
|
+
- name: Check out benchx
|
|
59
|
+
uses: actions/checkout@v4
|
|
60
|
+
with:
|
|
61
|
+
path: benchx
|
|
62
|
+
|
|
63
|
+
- name: Clone benchx_examples
|
|
64
|
+
uses: actions/checkout@v4
|
|
65
|
+
with:
|
|
66
|
+
repository: benchx-dev/benchx_examples
|
|
67
|
+
ref: ${{ inputs.examples_ref || 'main' }}
|
|
68
|
+
path: benchx_examples
|
|
69
|
+
|
|
70
|
+
# The repository keeps the output of earlier runs next to the scripts.
|
|
71
|
+
# Start clean instead
|
|
72
|
+
- name: Remove the output from examples/numpy-spin
|
|
73
|
+
working-directory: ${{ env.EXAMPLE }}
|
|
74
|
+
run: rm -rf results store.parquet
|
|
75
|
+
|
|
76
|
+
- name: Install system packages
|
|
77
|
+
run: |
|
|
78
|
+
sudo apt-get update
|
|
79
|
+
sudo apt-get install -y --no-install-recommends libopenblas-dev pkg-config ccache
|
|
80
|
+
|
|
81
|
+
# The key is new for every run, because a cache cannot be overwritten; a run starts
|
|
82
|
+
# from the most recent one. It is saved at the end, also when a later step fails.
|
|
83
|
+
- name: Restore the ccache cache
|
|
84
|
+
uses: actions/cache/restore@v4
|
|
85
|
+
with:
|
|
86
|
+
path: ${{ env.CCACHE_DIR }}
|
|
87
|
+
key: ccache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
88
|
+
restore-keys: ccache-${{ runner.os }}-
|
|
89
|
+
|
|
90
|
+
- name: Zero the ccache statistics
|
|
91
|
+
run: ccache --zero-stats
|
|
92
|
+
|
|
93
|
+
- uses: astral-sh/setup-uv@v5
|
|
94
|
+
with:
|
|
95
|
+
enable-cache: true
|
|
96
|
+
cache-dependency-glob: benchx/uv.lock
|
|
97
|
+
|
|
98
|
+
# The scripts run plain `python`, `bx` and `spin`, and hard-code
|
|
99
|
+
# lib/python3.12/site-packages, so this is Python 3.12 on the PATH. The `test`
|
|
100
|
+
# extra is only for pyperf, which the benchmarks need.
|
|
101
|
+
- name: Install benchx on Python 3.12
|
|
102
|
+
working-directory: benchx
|
|
103
|
+
run: |
|
|
104
|
+
uv python install 3.12
|
|
105
|
+
uv sync --extra test --python 3.12
|
|
106
|
+
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
|
|
107
|
+
|
|
108
|
+
- name: Install NumPy's build tools
|
|
109
|
+
run: uv pip install --python benchx/.venv/bin/python spin ninja meson-python cython
|
|
110
|
+
|
|
111
|
+
# The full history and the tags: track.sh checks out v2.4.3 and v2.4.0.
|
|
112
|
+
- name: Clone NumPy
|
|
113
|
+
run: |
|
|
114
|
+
git clone --quiet https://github.com/numpy/numpy.git "$NUMPY"
|
|
115
|
+
git -C "$NUMPY" submodule update --init
|
|
116
|
+
|
|
117
|
+
# Two cores for the benchmarks, all of them for the builds, so only `bx` is pinned:
|
|
118
|
+
# a `bx` ahead of the real one on the PATH, which the scripts call without knowing.
|
|
119
|
+
- name: Pin the benchmarks to two cores
|
|
120
|
+
run: |
|
|
121
|
+
mkdir -p "$RUNNER_TEMP/pin"
|
|
122
|
+
cat > "$RUNNER_TEMP/pin/bx" <<EOF
|
|
123
|
+
#!/bin/sh
|
|
124
|
+
exec taskset -c $BENCH_CPUS $PWD/benchx/.venv/bin/bx "\$@"
|
|
125
|
+
EOF
|
|
126
|
+
chmod +x "$RUNNER_TEMP/pin/bx"
|
|
127
|
+
echo "$RUNNER_TEMP/pin" >> "$GITHUB_PATH"
|
|
128
|
+
"$RUNNER_TEMP/pin/bx" --help > /dev/null
|
|
129
|
+
|
|
130
|
+
- name: Show what is under test
|
|
131
|
+
run: |
|
|
132
|
+
echo "python: $(python --version) ($(command -v python))"
|
|
133
|
+
echo "bx: $(command -v bx)"
|
|
134
|
+
echo "ccache: $(ccache --version | head -1)"
|
|
135
|
+
echo "benchx: $(git -C benchx rev-parse --short HEAD)"
|
|
136
|
+
echo "benchx_examples: $(git -C benchx_examples rev-parse --short HEAD)"
|
|
137
|
+
echo "numpy main: $(git -C "$NUMPY" rev-parse --short main)"
|
|
138
|
+
|
|
139
|
+
# num_threads.sh assumes a prebuilt NumPy at main, checked out.
|
|
140
|
+
- name: Build NumPy main
|
|
141
|
+
working-directory: ${{ env.NUMPY }}
|
|
142
|
+
run: spin build
|
|
143
|
+
|
|
144
|
+
# Before track.sh, which leaves the NumPy checkout at the last revision it built.
|
|
145
|
+
- name: Run num_threads.sh
|
|
146
|
+
working-directory: ${{ env.EXAMPLE }}
|
|
147
|
+
run: bash ./num_threads.sh
|
|
148
|
+
|
|
149
|
+
- name: Print the thread sweep results
|
|
150
|
+
working-directory: ${{ env.EXAMPLE }}
|
|
151
|
+
run: bx head --table -n 100
|
|
152
|
+
|
|
153
|
+
- name: Run track.sh
|
|
154
|
+
working-directory: ${{ env.EXAMPLE }}
|
|
155
|
+
run: bash ./track.sh
|
|
156
|
+
|
|
157
|
+
- name: Print the results across history
|
|
158
|
+
working-directory: ${{ env.EXAMPLE }}
|
|
159
|
+
run: bx head --table -n 100
|
|
160
|
+
|
|
161
|
+
- name: Show the ccache statistics
|
|
162
|
+
if: always()
|
|
163
|
+
run: ccache --show-stats
|
|
164
|
+
|
|
165
|
+
- name: Save the ccache cache
|
|
166
|
+
if: always()
|
|
167
|
+
uses: actions/cache/save@v4
|
|
168
|
+
with:
|
|
169
|
+
path: ${{ env.CCACHE_DIR }}
|
|
170
|
+
key: ccache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
171
|
+
|
|
172
|
+
- name: Upload the output
|
|
173
|
+
if: always()
|
|
174
|
+
uses: actions/upload-artifact@v4
|
|
175
|
+
with:
|
|
176
|
+
name: numpy-spin-output
|
|
177
|
+
path: |
|
|
178
|
+
benchx_examples/examples/numpy-spin/results
|
|
179
|
+
benchx_examples/examples/numpy-spin/store.parquet
|
|
180
|
+
if-no-files-found: warn
|
|
181
|
+
retention-days: 14
|
|
182
|
+
|
|
183
|
+
arrow:
|
|
184
|
+
name: arrow (demo, archery-local)
|
|
185
|
+
runs-on: ubuntu-latest
|
|
186
|
+
timeout-minutes: 45
|
|
187
|
+
steps:
|
|
188
|
+
- name: Check out benchx
|
|
189
|
+
uses: actions/checkout@v4
|
|
190
|
+
with:
|
|
191
|
+
path: benchx
|
|
192
|
+
|
|
193
|
+
- name: Clone benchx_examples
|
|
194
|
+
uses: actions/checkout@v4
|
|
195
|
+
with:
|
|
196
|
+
repository: benchx-dev/benchx_examples
|
|
197
|
+
ref: ${{ inputs.examples_ref || 'main' }}
|
|
198
|
+
path: benchx_examples
|
|
199
|
+
|
|
200
|
+
- uses: astral-sh/setup-uv@v5
|
|
201
|
+
with:
|
|
202
|
+
enable-cache: true
|
|
203
|
+
cache-dependency-glob: benchx/uv.lock
|
|
204
|
+
|
|
205
|
+
# The scripts run plain `python` and `bx`. benchx is installed in editable mode,
|
|
206
|
+
# which is where it reads its schemas from.
|
|
207
|
+
- name: Install benchx
|
|
208
|
+
working-directory: benchx
|
|
209
|
+
run: |
|
|
210
|
+
uv python install 3.13
|
|
211
|
+
uv sync --extra test --python 3.13
|
|
212
|
+
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
|
|
213
|
+
|
|
214
|
+
# cmake and a C++ compiler are preinstalled on the runner; CMake fetches
|
|
215
|
+
# Google Benchmark.
|
|
216
|
+
- name: Show what is under test
|
|
217
|
+
run: |
|
|
218
|
+
echo "python: $(python --version) ($(command -v python))"
|
|
219
|
+
echo "bx: $(command -v bx)"
|
|
220
|
+
echo "cmake: $(cmake --version | head -1)"
|
|
221
|
+
echo "c++: $(c++ --version | head -1)"
|
|
222
|
+
echo "benchx: $(git -C benchx rev-parse --short HEAD)"
|
|
223
|
+
echo "benchx_examples: $(git -C benchx_examples rev-parse --short HEAD)"
|
|
224
|
+
|
|
225
|
+
- name: Run the demo
|
|
226
|
+
working-directory: benchx_examples/examples/arrow/demo
|
|
227
|
+
run: bash ./run.sh
|
|
228
|
+
|
|
229
|
+
- name: Run archery-local
|
|
230
|
+
working-directory: benchx_examples/examples/arrow/archery-local
|
|
231
|
+
run: bash ./run.sh
|
|
232
|
+
|
|
233
|
+
- name: Upload the output
|
|
234
|
+
if: always()
|
|
235
|
+
uses: actions/upload-artifact@v4
|
|
236
|
+
with:
|
|
237
|
+
name: arrow-output
|
|
238
|
+
path: |
|
|
239
|
+
benchx_examples/examples/arrow/demo/store.parquet
|
|
240
|
+
benchx_examples/examples/arrow/archery-local/_work/results
|
|
241
|
+
if-no-files-found: warn
|
|
242
|
+
retention-days: 14
|
|
243
|
+
|
|
244
|
+
pyperf-suite:
|
|
245
|
+
name: pyperf-suite (run.sh)
|
|
246
|
+
runs-on: ubuntu-latest
|
|
247
|
+
timeout-minutes: 20
|
|
248
|
+
steps:
|
|
249
|
+
- name: Check out benchx
|
|
250
|
+
uses: actions/checkout@v4
|
|
251
|
+
with:
|
|
252
|
+
path: benchx
|
|
253
|
+
|
|
254
|
+
- name: Clone benchx_examples
|
|
255
|
+
uses: actions/checkout@v4
|
|
256
|
+
with:
|
|
257
|
+
repository: benchx-dev/benchx_examples
|
|
258
|
+
ref: ${{ inputs.examples_ref || 'main' }}
|
|
259
|
+
path: benchx_examples
|
|
260
|
+
|
|
261
|
+
- uses: astral-sh/setup-uv@v5
|
|
262
|
+
with:
|
|
263
|
+
enable-cache: true
|
|
264
|
+
cache-dependency-glob: benchx/uv.lock
|
|
265
|
+
|
|
266
|
+
# The script runs plain `python` and `bx`, and the workers need pyperf, which the
|
|
267
|
+
# `test` extra brings. benchx is installed in editable mode, which is where it reads
|
|
268
|
+
# its schemas from.
|
|
269
|
+
- name: Install benchx
|
|
270
|
+
working-directory: benchx
|
|
271
|
+
run: |
|
|
272
|
+
uv python install 3.13
|
|
273
|
+
uv sync --extra test --python 3.13
|
|
274
|
+
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
|
|
275
|
+
|
|
276
|
+
- name: Show what is under test
|
|
277
|
+
run: |
|
|
278
|
+
echo "python: $(python --version) ($(command -v python))"
|
|
279
|
+
echo "bx: $(command -v bx)"
|
|
280
|
+
echo "pyperf: $(python -c 'import pyperf; print(pyperf.__version__)')"
|
|
281
|
+
echo "benchx: $(git -C benchx rev-parse --short HEAD)"
|
|
282
|
+
echo "benchx_examples: $(git -C benchx_examples rev-parse --short HEAD)"
|
|
283
|
+
|
|
284
|
+
- name: Run the pyperf suite
|
|
285
|
+
working-directory: benchx_examples/examples/pyperf-suite
|
|
286
|
+
run: bash ./run.sh
|
|
287
|
+
|
|
288
|
+
- name: Upload the output
|
|
289
|
+
if: always()
|
|
290
|
+
uses: actions/upload-artifact@v4
|
|
291
|
+
with:
|
|
292
|
+
name: pyperf-suite-output
|
|
293
|
+
path: benchx_examples/examples/pyperf-suite/out
|
|
294
|
+
if-no-files-found: warn
|
|
295
|
+
retention-days: 14
|
|
296
|
+
|
|
297
|
+
matmul-params:
|
|
298
|
+
name: matmul-params (quick version)
|
|
299
|
+
runs-on: ubuntu-latest
|
|
300
|
+
timeout-minutes: 20
|
|
301
|
+
env:
|
|
302
|
+
# Keep the result store with the output, as the README does, not in the home directory.
|
|
303
|
+
BENCHX_HOME: ${{ github.workspace }}/benchx_examples/examples/matmul-params/out/home
|
|
304
|
+
steps:
|
|
305
|
+
- name: Check out benchx
|
|
306
|
+
uses: actions/checkout@v4
|
|
307
|
+
with:
|
|
308
|
+
path: benchx
|
|
309
|
+
|
|
310
|
+
- name: Clone benchx_examples
|
|
311
|
+
uses: actions/checkout@v4
|
|
312
|
+
with:
|
|
313
|
+
repository: benchx-dev/benchx_examples
|
|
314
|
+
ref: ${{ inputs.examples_ref || 'main' }}
|
|
315
|
+
path: benchx_examples
|
|
316
|
+
|
|
317
|
+
- uses: astral-sh/setup-uv@v5
|
|
318
|
+
with:
|
|
319
|
+
enable-cache: true
|
|
320
|
+
cache-dependency-glob: benchx/uv.lock
|
|
321
|
+
|
|
322
|
+
# The workers need pyperf, which the `test` extra brings. benchx is installed in
|
|
323
|
+
# editable mode, which is where it reads its schemas from.
|
|
324
|
+
- name: Install benchx
|
|
325
|
+
working-directory: benchx
|
|
326
|
+
run: |
|
|
327
|
+
uv python install 3.13
|
|
328
|
+
uv sync --extra test --python 3.13
|
|
329
|
+
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
|
|
330
|
+
|
|
331
|
+
# The README's install lines. torch comes from PyTorch's CPU index: the default
|
|
332
|
+
# build is several GB of CUDA libraries that the runner has no use for.
|
|
333
|
+
- name: Install NumPy and PyTorch
|
|
334
|
+
run: |
|
|
335
|
+
uv pip install --python benchx/.venv/bin/python numpy
|
|
336
|
+
uv pip install --python benchx/.venv/bin/python torch --index-url https://download.pytorch.org/whl/cpu
|
|
337
|
+
|
|
338
|
+
- name: Show what is under test
|
|
339
|
+
run: |
|
|
340
|
+
echo "python: $(python --version) ($(command -v python))"
|
|
341
|
+
echo "bx: $(command -v bx)"
|
|
342
|
+
echo "pyperf: $(python -c 'import pyperf; print(pyperf.__version__)')"
|
|
343
|
+
echo "numpy: $(python -c 'import numpy; print(numpy.__version__)')"
|
|
344
|
+
echo "torch: $(python -c 'import torch; print(torch.__version__)')"
|
|
345
|
+
echo "benchx: $(git -C benchx rev-parse --short HEAD)"
|
|
346
|
+
echo "benchx_examples: $(git -C benchx_examples rev-parse --short HEAD)"
|
|
347
|
+
|
|
348
|
+
# The quick version of the README: 2 processes x 2 values per case, 0.01 s of
|
|
349
|
+
# calibration. With pyperf's defaults it takes several minutes, mostly importing torch
|
|
350
|
+
# in every worker. `bx bench` prints one row per case.
|
|
351
|
+
- name: Run the quick version
|
|
352
|
+
working-directory: benchx_examples/examples/matmul-params
|
|
353
|
+
run: bx bench bench_matmul.py --processes 2 --values 2 --min-time 0.01 --out out
|
|
354
|
+
|
|
355
|
+
- name: Upload the output
|
|
356
|
+
if: always()
|
|
357
|
+
uses: actions/upload-artifact@v4
|
|
358
|
+
with:
|
|
359
|
+
name: matmul-params-output
|
|
360
|
+
path: benchx_examples/examples/matmul-params/out
|
|
361
|
+
if-no-files-found: warn
|
|
362
|
+
retention-days: 14
|
|
363
|
+
|
|
364
|
+
numpy-venvs:
|
|
365
|
+
name: numpy-venvs (run.sh)
|
|
366
|
+
runs-on: ubuntu-latest
|
|
367
|
+
timeout-minutes: 30
|
|
368
|
+
steps:
|
|
369
|
+
- name: Check out benchx
|
|
370
|
+
uses: actions/checkout@v4
|
|
371
|
+
with:
|
|
372
|
+
path: benchx
|
|
373
|
+
|
|
374
|
+
- name: Clone benchx_examples
|
|
375
|
+
uses: actions/checkout@v4
|
|
376
|
+
with:
|
|
377
|
+
repository: benchx-dev/benchx_examples
|
|
378
|
+
ref: ${{ inputs.examples_ref || 'main' }}
|
|
379
|
+
path: benchx_examples
|
|
380
|
+
|
|
381
|
+
- uses: astral-sh/setup-uv@v5
|
|
382
|
+
with:
|
|
383
|
+
enable-cache: true
|
|
384
|
+
cache-dependency-glob: benchx/uv.lock
|
|
385
|
+
|
|
386
|
+
# The script makes two venvs of its own with uv (Python 3.12, the newest with numpy
|
|
387
|
+
# 1.26.4 wheels) and installs benchx in both, from BENCHX_SRC (set on the run step).
|
|
388
|
+
# Left unset, it takes the checkout from the benchx of the active environment and assumes
|
|
389
|
+
# that the package sits directly in the project directory, which it does not under src/.
|
|
390
|
+
# The venvs bring their own pyperf.
|
|
391
|
+
- name: Install benchx
|
|
392
|
+
working-directory: benchx
|
|
393
|
+
run: |
|
|
394
|
+
uv python install 3.13
|
|
395
|
+
uv sync --python 3.13
|
|
396
|
+
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
|
|
397
|
+
|
|
398
|
+
- name: Show what is under test
|
|
399
|
+
run: |
|
|
400
|
+
echo "python: $(python --version) ($(command -v python))"
|
|
401
|
+
echo "uv: $(uv --version)"
|
|
402
|
+
echo "benchx: $(git -C benchx rev-parse --short HEAD)"
|
|
403
|
+
echo "benchx_examples: $(git -C benchx_examples rev-parse --short HEAD)"
|
|
404
|
+
|
|
405
|
+
- name: Run the numpy-venvs example
|
|
406
|
+
working-directory: benchx_examples/examples/numpy-venvs
|
|
407
|
+
env:
|
|
408
|
+
BENCHX_SRC: ${{ github.workspace }}/benchx
|
|
409
|
+
run: bash ./run.sh
|
|
410
|
+
|
|
411
|
+
- name: Upload the output
|
|
412
|
+
if: always()
|
|
413
|
+
uses: actions/upload-artifact@v4
|
|
414
|
+
with:
|
|
415
|
+
name: numpy-venvs-output
|
|
416
|
+
path: benchx_examples/examples/numpy-venvs/out
|
|
417
|
+
if-no-files-found: warn
|
|
418
|
+
retention-days: 14
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publishes benchx to PyPI and creates the GitHub release, when the tag v<version> is pushed.
|
|
4
|
+
# docs/releasing.md is the checklist. A tag such as v0.1.0rc1 makes a pre-release.
|
|
5
|
+
#
|
|
6
|
+
# The package is tested before anything is uploaded. Conda packages are not built here: they
|
|
7
|
+
# come from the benchx feedstock on conda-forge, which follows the releases on PyPI.
|
|
8
|
+
#
|
|
9
|
+
# Only a tag publishes. A pull request that changes the packaging or the version runs the build
|
|
10
|
+
# job and uploads nothing.
|
|
11
|
+
#
|
|
12
|
+
# This needs, on GitHub, the pypi environment with its required reviewers, and on PyPI a trusted
|
|
13
|
+
# publisher for this file and that environment. The actions are pinned to commits since they
|
|
14
|
+
# handle the uploads.
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
push:
|
|
18
|
+
tags: ["v*"]
|
|
19
|
+
pull_request:
|
|
20
|
+
branches: [main]
|
|
21
|
+
paths:
|
|
22
|
+
- ".github/workflows/release.yml"
|
|
23
|
+
- "pyproject.toml"
|
|
24
|
+
- "src/benchx/__init__.py"
|
|
25
|
+
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
build:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
outputs:
|
|
33
|
+
version: ${{ steps.version.outputs.version }}
|
|
34
|
+
prerelease: ${{ steps.version.outputs.prerelease }}
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
with:
|
|
38
|
+
persist-credentials: false
|
|
39
|
+
|
|
40
|
+
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
41
|
+
|
|
42
|
+
- name: Build the sdist, and the wheel from it
|
|
43
|
+
run: uv build
|
|
44
|
+
|
|
45
|
+
- name: Read the version from the sdist
|
|
46
|
+
id: version
|
|
47
|
+
run: |
|
|
48
|
+
version=$(basename dist/benchx-*.tar.gz .tar.gz)
|
|
49
|
+
version=${version#benchx-}
|
|
50
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
51
|
+
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
52
|
+
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
|
53
|
+
else
|
|
54
|
+
echo "prerelease=true" >> "$GITHUB_OUTPUT"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
- name: Check that the tag names this version
|
|
58
|
+
if: github.ref_type == 'tag'
|
|
59
|
+
env:
|
|
60
|
+
TAG: ${{ github.ref_name }}
|
|
61
|
+
VERSION: ${{ steps.version.outputs.version }}
|
|
62
|
+
run: |
|
|
63
|
+
if [ "$TAG" != "v$VERSION" ]; then
|
|
64
|
+
echo "::error::tag $TAG does not match the package version $VERSION"
|
|
65
|
+
exit 1
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
- name: Check the package metadata
|
|
69
|
+
run: uvx twine check --strict dist/*
|
|
70
|
+
|
|
71
|
+
- name: Install the wheel into a clean environment and test it
|
|
72
|
+
run: |
|
|
73
|
+
uv venv --python 3.13 "$RUNNER_TEMP/venv"
|
|
74
|
+
source "$RUNNER_TEMP/venv/bin/activate"
|
|
75
|
+
uv pip install "$(ls dist/*.whl)[test]"
|
|
76
|
+
# Away from the checkout, so that nothing can import it instead of the installed package.
|
|
77
|
+
cd "$RUNNER_TEMP"
|
|
78
|
+
bx --help
|
|
79
|
+
python -m pytest --pyargs benchx -ra
|
|
80
|
+
|
|
81
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
82
|
+
with:
|
|
83
|
+
name: dist
|
|
84
|
+
path: dist/
|
|
85
|
+
if-no-files-found: error
|
|
86
|
+
|
|
87
|
+
publish-pypi:
|
|
88
|
+
needs: build
|
|
89
|
+
# Also what keeps the job after this one off pull requests and forks: it needs this one.
|
|
90
|
+
if: github.repository == 'benchx-dev/benchx' && github.ref_type == 'tag'
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
environment:
|
|
93
|
+
name: pypi
|
|
94
|
+
url: https://pypi.org/project/benchx/${{ needs.build.outputs.version }}/
|
|
95
|
+
permissions:
|
|
96
|
+
id-token: write
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
99
|
+
with:
|
|
100
|
+
name: dist
|
|
101
|
+
path: dist
|
|
102
|
+
|
|
103
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
104
|
+
|
|
105
|
+
github-release:
|
|
106
|
+
needs: [build, publish-pypi]
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
permissions:
|
|
109
|
+
contents: write
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
112
|
+
with:
|
|
113
|
+
name: dist
|
|
114
|
+
path: release-files
|
|
115
|
+
|
|
116
|
+
- name: Create the release
|
|
117
|
+
env:
|
|
118
|
+
GH_TOKEN: ${{ github.token }}
|
|
119
|
+
GH_REPO: ${{ github.repository }}
|
|
120
|
+
TAG: ${{ github.ref_name }}
|
|
121
|
+
PRERELEASE: ${{ needs.build.outputs.prerelease }}
|
|
122
|
+
run: gh release create "$TAG" release-files/* --verify-tag --generate-notes --prerelease="$PRERELEASE"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: benchx tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- "src/**"
|
|
8
|
+
- "tests/**"
|
|
9
|
+
- "pyproject.toml"
|
|
10
|
+
- "uv.lock"
|
|
11
|
+
- ".github/workflows/**"
|
|
12
|
+
pull_request:
|
|
13
|
+
branches: [main]
|
|
14
|
+
paths:
|
|
15
|
+
- "src/**"
|
|
16
|
+
- "tests/**"
|
|
17
|
+
- "pyproject.toml"
|
|
18
|
+
- "uv.lock"
|
|
19
|
+
- ".github/workflows/**"
|
|
20
|
+
|
|
21
|
+
concurrency:
|
|
22
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
23
|
+
cancel-in-progress: true
|
|
24
|
+
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
test:
|
|
30
|
+
name: ${{ matrix.os }} / py${{ matrix.python-version }}
|
|
31
|
+
runs-on: ${{ matrix.os }}
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
os: [ubuntu-latest, macos-latest]
|
|
36
|
+
python-version: ["3.11", "3.13"]
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- uses: astral-sh/setup-uv@v5
|
|
41
|
+
with:
|
|
42
|
+
enable-cache: true
|
|
43
|
+
cache-dependency-glob: uv.lock
|
|
44
|
+
|
|
45
|
+
- name: Install Python ${{ matrix.python-version }}
|
|
46
|
+
run: uv python install ${{ matrix.python-version }}
|
|
47
|
+
|
|
48
|
+
- name: Install package and test dependencies
|
|
49
|
+
run: uv sync --extra test --python ${{ matrix.python-version }}
|
|
50
|
+
|
|
51
|
+
- name: Run tests
|
|
52
|
+
run: uv run --extra test --python ${{ matrix.python-version }} python -m pytest tests -ra
|
|
53
|
+
|
|
54
|
+
# An editable install finds the schemas next to the source, so the matrix above cannot
|
|
55
|
+
# tell whether a wheel carries them. This installs the built wheel (not editable) into a
|
|
56
|
+
# clean environment, runs `bx` from outside the checkout, and runs the test suite that the
|
|
57
|
+
# wheel itself ships (benchx/tests), so it checks the wheel's contents as well as its code.
|
|
58
|
+
wheel:
|
|
59
|
+
name: wheel / py3.13
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- uses: astral-sh/setup-uv@v5
|
|
65
|
+
|
|
66
|
+
- name: Build the wheel
|
|
67
|
+
run: uv build --wheel
|
|
68
|
+
|
|
69
|
+
- name: Install the wheel into a clean environment and test it
|
|
70
|
+
run: |
|
|
71
|
+
uv venv --python 3.13 "$RUNNER_TEMP/venv"
|
|
72
|
+
source "$RUNNER_TEMP/venv/bin/activate"
|
|
73
|
+
uv pip install "$(ls dist/*.whl)[test]"
|
|
74
|
+
# Away from the checkout, so that nothing can import it instead of the installed package.
|
|
75
|
+
cd "$RUNNER_TEMP"
|
|
76
|
+
bx --help
|
|
77
|
+
python -m pytest --pyargs benchx -ra
|