Skip to content

Commit b751eca

Browse files
committed
Add JIT to daily runs and reschedule the upload
1 parent 71dd85d commit b751eca

File tree

2 files changed

+82
-93
lines changed

2 files changed

+82
-93
lines changed

.claude/settings.local.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/daily-benchmark.yml

Lines changed: 82 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@ name: Daily Memory Tracker Benchmark
22

33
on:
44
schedule:
5-
# Run daily at 02:00 UTC
6-
- cron: '0 2 * * *'
5+
# Run daily at 23:00 UTC (EOD) to pick up all commits from the day
6+
- cron: '0 23 * * *'
77
workflow_dispatch:
88
inputs:
99
target_date:
1010
description: 'Date to get commits from (YYYY-MM-DD, defaults to today)'
1111
required: false
1212
type: string
13-
binary_id:
14-
description: 'Binary ID to use for benchmarking'
15-
required: false
16-
default: 'default'
1713
environment_id:
1814
description: 'Environment ID'
1915
required: false
20-
default: 'gcc-11'
16+
default: 'gh_actions'
2117
server_url:
2218
description: 'Memory tracker server URL'
2319
required: false
@@ -26,26 +22,54 @@ on:
2622
description: 'CPython repository URL'
2723
required: false
2824
default: 'https://github.com/python/cpython.git'
25+
llvm:
26+
description: 'LLVM version to use for JIT builds'
27+
required: false
28+
default: '19'
2929

3030
jobs:
31-
get-daily-commits:
31+
benchmark-builds:
3232
runs-on: ubuntu-latest
33-
outputs:
34-
commits: ${{ steps.get-commits.outputs.commits }}
35-
commit-count: ${{ steps.get-commits.outputs.commit-count }}
33+
strategy:
34+
matrix:
35+
build_config:
36+
- binary_id: 'default'
37+
configure_flags: '-C'
38+
description: 'Default build'
39+
install_deps: 'standard'
40+
- binary_id: 'debug'
41+
configure_flags: '--with-pydebug'
42+
description: 'Debug build'
43+
install_deps: 'standard'
44+
- binary_id: 'jit'
45+
configure_flags: '--enable-experimental-jit'
46+
description: 'JIT build'
47+
install_deps: 'jit'
48+
- binary_id: 'lto-pgo'
49+
configure_flags: '--with-lto --enable-optimizations'
50+
description: 'LTO-PGO build'
51+
install_deps: 'standard'
52+
- binary_id: 'nogil'
53+
configure_flags: '--disable-gil'
54+
description: 'Free-threaded build'
55+
install_deps: 'standard'
56+
fail-fast: false
3657

3758
steps:
38-
- name: Clone CPython repository
59+
- name: Checkout memory tracker
60+
uses: actions/checkout@v4
61+
62+
- name: Set up Python
63+
uses: actions/setup-python@v4
64+
with:
65+
python-version: '3.11'
66+
67+
- name: Clone CPython repository and get commits
3968
run: |
4069
git clone ${{ github.event.inputs.cpython_repo || 'https://github.com/python/cpython.git' }} cpython
4170
cd cpython
4271
git fetch --all
4372
44-
- name: Get commits from target date
45-
id: get-commits
46-
run: |
47-
cd cpython
48-
4973
# Determine target date
5074
if [ -n "${{ github.event.inputs.target_date }}" ]; then
5175
TARGET_DATE="${{ github.event.inputs.target_date }}"
@@ -60,45 +84,30 @@ jobs:
6084
6185
if [ -z "$COMMITS" ]; then
6286
echo "No commits found for date $TARGET_DATE"
63-
echo "commits=" >> $GITHUB_OUTPUT
64-
echo "commit-count=0" >> $GITHUB_OUTPUT
87+
exit 1
6588
else
66-
# Convert to JSON array format for matrix strategy
67-
COMMITS_JSON=$(echo "$COMMITS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
6889
COMMIT_COUNT=$(echo "$COMMITS" | wc -l)
90+
FIRST_COMMIT=$(echo "$COMMITS" | head -1)
91+
LAST_COMMIT=$(echo "$COMMITS" | tail -1)
6992
7093
echo "Found $COMMIT_COUNT commits for date $TARGET_DATE"
71-
echo "commits=$COMMITS_JSON" >> $GITHUB_OUTPUT
72-
echo "commit-count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
94+
echo "COMMIT_RANGE=${FIRST_COMMIT}..${LAST_COMMIT}" >> $GITHUB_ENV
95+
echo "COMMIT_COUNT=$COMMIT_COUNT" >> $GITHUB_ENV
7396
7497
echo "Commits to benchmark:"
7598
echo "$COMMITS"
7699
fi
77-
78-
benchmark-commits:
79-
needs: get-daily-commits
80-
if: needs.get-daily-commits.outputs.commit-count > 0
81-
runs-on: ubuntu-latest
82-
strategy:
83-
matrix:
84-
commit: ${{ fromJson(needs.get-daily-commits.outputs.commits) }}
85-
fail-fast: false
86-
max-parallel: 3
87-
88-
steps:
89-
- name: Checkout memory tracker
90-
uses: actions/checkout@v4
91-
92-
- name: Set up Python
93-
uses: actions/setup-python@v4
94-
with:
95-
python-version: '3.11'
96100
97-
- name: Clone CPython repository
101+
- name: Print environment variables
98102
run: |
99-
git clone ${{ github.event.inputs.cpython_repo || 'https://github.com/python/cpython.git' }} cpython
100-
cd cpython
101-
git fetch --depth=200
103+
echo "=== Environment Variables ==="
104+
echo "COMMIT_RANGE: $COMMIT_RANGE"
105+
echo "COMMIT_COUNT: $COMMIT_COUNT"
106+
echo "Binary ID: ${{ matrix.build_config.binary_id }}"
107+
echo "Description: ${{ matrix.build_config.description }}"
108+
echo "Configure flags: ${{ matrix.build_config.configure_flags }}"
109+
echo "Install deps: ${{ matrix.build_config.install_deps }}"
110+
echo "=========================="
102111
103112
- name: Install memory tracker worker
104113
run: |
@@ -110,6 +119,11 @@ jobs:
110119
# Install CPython dependencies using their script
111120
cd cpython
112121
sudo .github/workflows/posix-deps-apt.sh
122+
123+
# Install JIT dependencies if needed
124+
if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
125+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ github.event.inputs.llvm || '19' }}
126+
fi
113127
114128
# Install Memray dependencies
115129
sudo apt-get install -y \
@@ -118,31 +132,33 @@ jobs:
118132
libunwind-dev \
119133
liblz4-dev
120134
121-
- name: Run memory benchmark for commit
135+
- name: Run memory benchmark for commit range - ${{ matrix.build_config.description }}
122136
env:
123137
MEMORY_TRACKER_TOKEN: ${{ secrets.MEMORY_TRACKER_TOKEN }}
124138
run: |
125-
COMMIT="${{ matrix.commit }}"
126-
127-
# Build command for single commit
128-
CMD="memory-tracker benchmark '$COMMIT'"
129-
CMD="$CMD --repo-path ./cpython"
130-
CMD="$CMD --binary-id '${{ github.event.inputs.binary_id || 'default' }}'"
131-
CMD="$CMD --environment-id '${{ github.event.inputs.environment_id || 'gcc-11' }}'"
132-
CMD="$CMD --api-base '${{ github.event.inputs.server_url || 'https://memory.python.org' }}'"
133-
CMD="$CMD --output-dir ./benchmark_results"
134-
CMD="$CMD --force"
135-
CMD="$CMD -vv"
139+
if [ "${{ matrix.build_config.install_deps }}" = "jit" ]; then
140+
export PATH="$(llvm-config-${{ github.event.inputs.llvm || '19' }} --bindir):$PATH"
141+
export LLVM_VERSION="${{ github.event.inputs.llvm || '19' }}"
142+
echo "LLVM Path: $(llvm-config-${{ github.event.inputs.llvm || '19' }} --bindir)"
143+
echo "Clang version: $(clang-${{ github.event.inputs.llvm || '19' }} --version || echo 'clang-${{ github.event.inputs.llvm || '19' }} not found')"
144+
fi
136145
137-
echo "Running benchmark for commit: $COMMIT"
138-
echo "Command: $CMD"
139-
eval $CMD
146+
# Build command for commit range
147+
memory-tracker benchmark "$COMMIT_RANGE" \
148+
--repo-path ./cpython \
149+
--binary-id "${{ matrix.build_config.binary_id }}" \
150+
--environment-id "${{ github.event.inputs.environment_id || 'gh_actions' }}" \
151+
--api-base "${{ github.event.inputs.server_url || 'https://memory.python.org' }}" \
152+
--output-dir ./benchmark_results \
153+
--configure-flags="${{ matrix.build_config.configure_flags }}" \
154+
--force \
155+
-vv
140156
141157
- name: Upload benchmark results (if failed)
142158
if: failure()
143159
uses: actions/upload-artifact@v4
144160
with:
145-
name: benchmark-logs-${{ matrix.commit }}
161+
name: benchmark-logs-${{ matrix.build_config.binary_id }}
146162
path: |
147163
*.log
148164
./benchmark_results/
@@ -152,23 +168,18 @@ jobs:
152168
if: success()
153169
uses: actions/upload-artifact@v4
154170
with:
155-
name: benchmark-results-${{ matrix.commit }}
171+
name: benchmark-results-${{ matrix.build_config.binary_id }}
156172
path: ./benchmark_results/
157173
retention-days: 30
158174

159175
summary:
160-
needs: [get-daily-commits, benchmark-commits]
176+
needs: benchmark-builds
161177
if: always()
162178
runs-on: ubuntu-latest
163179

164180
steps:
165181
- name: Print summary
166182
run: |
167183
echo "Daily benchmark run completed"
168-
echo "Total commits processed: ${{ needs.get-daily-commits.outputs.commit-count }}"
169-
170-
if [ "${{ needs.get-daily-commits.outputs.commit-count }}" = "0" ]; then
171-
echo "No commits found for the target date"
172-
else
173-
echo "Benchmark jobs completed with status: ${{ needs.benchmark-commits.result }}"
174-
fi
184+
echo "Benchmark jobs completed with status: ${{ needs.benchmark-builds.result }}"
185+
echo "Binary types benchmarked: default, debug, jit, lto-pgo, nogil"

0 commit comments

Comments
 (0)