Compare commits
1 Commits
c3da60c412
...
bfadc04ca7
| Author | SHA1 | Date | |
|---|---|---|---|
| bfadc04ca7 |
127
.gitea/workflows/Benchmark.yaml
Normal file
127
.gitea/workflows/Benchmark.yaml
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
name: Merge-Checker
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
paths-ignore:
|
||||||
|
- 'unit-tests/timing-results/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Benchmarking:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install dependencies (CMake + Ninja + build tools)
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y cmake ninja-build build-essential time git
|
||||||
|
|
||||||
|
- name: Configure project with CMake
|
||||||
|
run: cmake -G Ninja -S . -B build/
|
||||||
|
|
||||||
|
- name: Build with Ninja
|
||||||
|
run: ninja -C build/
|
||||||
|
|
||||||
|
- name: Run matrix-timing-tests
|
||||||
|
run: |
|
||||||
|
mkdir -p unit-tests/timing-results
|
||||||
|
if [ -x build/unit-tests/matrix-timing-tests ]; then
|
||||||
|
echo "Running matrix-timing-tests with timing"
|
||||||
|
/usr/bin/time -v build/unit-tests/matrix-timing-tests -d yes &> unit-tests/timing-results/matrix-timing-tests.txt
|
||||||
|
cat unit-tests/timing-results/matrix-timing-tests.txt
|
||||||
|
else
|
||||||
|
echo "matrix-timing-tests executable not found or not executable"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Compare timing results
|
||||||
|
id: check_diff
|
||||||
|
run: |
|
||||||
|
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
|
||||||
|
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
|
||||||
|
|
||||||
|
echo "Comparing timing results for changes ≥ 0.1s (ignoring 'Timing Tests' lines)..."
|
||||||
|
|
||||||
|
changed=0
|
||||||
|
|
||||||
|
awk -v changed_ref=/tmp/timings_changed.flag '
|
||||||
|
BEGIN {
|
||||||
|
change_threshold = 0.1
|
||||||
|
}
|
||||||
|
FILENAME == "old.txt" && /^[0-9]+\.[0-9]+ s: / {
|
||||||
|
label = substr($0, index($0, ":") + 2)
|
||||||
|
if (label != "Timing Tests") {
|
||||||
|
label_times[label] = $1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FILENAME == "new.txt" && /^[0-9]+\.[0-9]+ s: / {
|
||||||
|
new_time = $1
|
||||||
|
label = substr($0, index($0, ":") + 2)
|
||||||
|
if (label == "Timing Tests") next
|
||||||
|
|
||||||
|
old_time = label_times[label]
|
||||||
|
delta = new_time - old_time
|
||||||
|
if (delta < 0) delta = -delta
|
||||||
|
|
||||||
|
if (old_time != "" && delta >= change_threshold) {
|
||||||
|
printf "⚠️ %.3f s → %.3f s: %s (Δ=%.3f s)\n", old_time, new_time, label, delta
|
||||||
|
system("touch " changed_ref)
|
||||||
|
} else if (old_time == "") {
|
||||||
|
printf "🆕 New timing entry: %.3f s: %s\n", new_time, label
|
||||||
|
system("touch " changed_ref)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (!system("test -f " changed_ref)) {
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
print "✅ Timings haven’t changed significantly (Δ < 0.1s)."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' old.txt new.txt
|
||||||
|
|
||||||
|
if [ -f /tmp/timings_changed.flag ]; then
|
||||||
|
echo "timings_changed=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "timings_changed=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit and push timing results
|
||||||
|
if: steps.check_diff.outputs.timings_changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
git config --global user.name "ci-bot"
|
||||||
|
git config --global user.email "ci-bot@local"
|
||||||
|
|
||||||
|
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
||||||
|
git stash
|
||||||
|
echo "Checking out source branch $BRANCH_NAME"
|
||||||
|
git fetch origin "$BRANCH_NAME"
|
||||||
|
git checkout "$BRANCH_NAME"
|
||||||
|
git pull
|
||||||
|
|
||||||
|
echo "Checking if last commit was a timing update"
|
||||||
|
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||||
|
|
||||||
|
if echo "$LAST_COMMIT_MSG" | grep -q "Update matrix-timing-tests timings"; then
|
||||||
|
echo "Last commit was a timing update, skipping commit."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Last commit name was: $LAST_COMMIT_MSG"
|
||||||
|
git stash pop
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add unit-tests/timing-results/matrix-timing-tests.txt
|
||||||
|
|
||||||
|
if git diff --quiet --cached; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
else
|
||||||
|
git commit -m "Update matrix-timing-tests timings [skip ci]"
|
||||||
|
git push origin "$BRANCH_NAME"
|
||||||
|
fi
|
||||||
@@ -3,129 +3,8 @@ name: Merge-Checker
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["**"]
|
branches: ["**"]
|
||||||
paths-ignore:
|
|
||||||
- 'unit-tests/timing-results/**'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Benchmarking:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout source code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
persist-credentials: true
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install dependencies (CMake + Ninja + build tools)
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y cmake ninja-build build-essential time git
|
|
||||||
|
|
||||||
- name: Configure project with CMake
|
|
||||||
run: cmake -G Ninja -S . -B build/
|
|
||||||
|
|
||||||
- name: Build with Ninja
|
|
||||||
run: ninja -C build/
|
|
||||||
|
|
||||||
- name: Run matrix-timing-tests
|
|
||||||
run: |
|
|
||||||
mkdir -p unit-tests/timing-results
|
|
||||||
if [ -x build/unit-tests/matrix-timing-tests ]; then
|
|
||||||
echo "Running matrix-timing-tests with timing"
|
|
||||||
/usr/bin/time -v build/unit-tests/matrix-timing-tests -d yes &> unit-tests/timing-results/matrix-timing-tests.txt
|
|
||||||
cat unit-tests/timing-results/matrix-timing-tests.txt
|
|
||||||
else
|
|
||||||
echo "matrix-timing-tests executable not found or not executable"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Compare timing results
|
|
||||||
id: check_diff
|
|
||||||
run: |
|
|
||||||
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
|
|
||||||
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
|
|
||||||
|
|
||||||
echo "Comparing timing results for changes ≥ 0.1s (ignoring 'Timing Tests' lines)..."
|
|
||||||
|
|
||||||
changed=0
|
|
||||||
|
|
||||||
awk -v changed_ref=/tmp/timings_changed.flag '
|
|
||||||
BEGIN {
|
|
||||||
change_threshold = 0.1
|
|
||||||
}
|
|
||||||
FILENAME == "old.txt" && /^[0-9]+\.[0-9]+ s: / {
|
|
||||||
label = substr($0, index($0, ":") + 2)
|
|
||||||
if (label != "Timing Tests") {
|
|
||||||
label_times[label] = $1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FILENAME == "new.txt" && /^[0-9]+\.[0-9]+ s: / {
|
|
||||||
new_time = $1
|
|
||||||
label = substr($0, index($0, ":") + 2)
|
|
||||||
if (label == "Timing Tests") next
|
|
||||||
|
|
||||||
old_time = label_times[label]
|
|
||||||
delta = new_time - old_time
|
|
||||||
if (delta < 0) delta = -delta
|
|
||||||
|
|
||||||
if (old_time != "" && delta >= change_threshold) {
|
|
||||||
printf "⚠️ %.3f s → %.3f s: %s (Δ=%.3f s)\n", old_time, new_time, label, delta
|
|
||||||
system("touch " changed_ref)
|
|
||||||
} else if (old_time == "") {
|
|
||||||
printf "🆕 New timing entry: %.3f s: %s\n", new_time, label
|
|
||||||
system("touch " changed_ref)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
if (!system("test -f " changed_ref)) {
|
|
||||||
exit 0
|
|
||||||
} else {
|
|
||||||
print "✅ Timings haven’t changed significantly (Δ < 0.1s)."
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' old.txt new.txt
|
|
||||||
|
|
||||||
if [ -f /tmp/timings_changed.flag ]; then
|
|
||||||
echo "timings_changed=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "timings_changed=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit and push timing results
|
|
||||||
if: steps.check_diff.outputs.timings_changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
|
|
||||||
run: |
|
|
||||||
git config --global user.name "ci-bot"
|
|
||||||
git config --global user.email "ci-bot@local"
|
|
||||||
|
|
||||||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
|
||||||
git stash
|
|
||||||
echo "Checking out source branch $BRANCH_NAME"
|
|
||||||
git fetch origin "$BRANCH_NAME"
|
|
||||||
git checkout "$BRANCH_NAME"
|
|
||||||
git pull
|
|
||||||
|
|
||||||
echo "Checking if last commit was a timing update"
|
|
||||||
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
||||||
|
|
||||||
if echo "$LAST_COMMIT_MSG" | grep -q "Update matrix-timing-tests timings"; then
|
|
||||||
echo "Last commit was a timing update, skipping commit."
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "Last commit name was: $LAST_COMMIT_MSG"
|
|
||||||
git stash pop
|
|
||||||
fi
|
|
||||||
|
|
||||||
git add unit-tests/timing-results/matrix-timing-tests.txt
|
|
||||||
|
|
||||||
if git diff --quiet --cached; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
git commit -m "Update matrix-timing-tests timings [skip ci]"
|
|
||||||
git push origin "$BRANCH_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_and_test:
|
build_and_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
Randomness seeded to: 3576947534
|
Randomness seeded to: 2310772973
|
||||||
0.177 s: Addition
|
0.174 s: Addition
|
||||||
0.178 s: Timing Tests
|
0.174 s: Timing Tests
|
||||||
0.182 s: Subtraction
|
0.169 s: Subtraction
|
||||||
0.182 s: Timing Tests
|
0.169 s: Timing Tests
|
||||||
1.889 s: Multiplication
|
20 s: Multiplication
|
||||||
1.889 s: Timing Tests
|
1.853 s: Timing Tests
|
||||||
0.126 s: Scalar Multiplication
|
0.121 s: Scalar Multiplication
|
||||||
0.126 s: Timing Tests
|
0.121 s: Timing Tests
|
||||||
0.176 s: Element Multiply
|
0.177 s: Element Multiply
|
||||||
0.176 s: Timing Tests
|
0.177 s: Timing Tests
|
||||||
0.175 s: Element Divide
|
0.168 s: Element Divide
|
||||||
0.175 s: Timing Tests
|
0.168 s: Timing Tests
|
||||||
0.151 s: Minor Matrix
|
0.150 s: Minor Matrix
|
||||||
0.151 s: Timing Tests
|
0.150 s: Timing Tests
|
||||||
0.099 s: Determinant
|
0.102 s: Determinant
|
||||||
0.100 s: Timing Tests
|
0.102 s: Timing Tests
|
||||||
0.412 s: Matrix of Minors
|
0.419 s: Matrix of Minors
|
||||||
0.412 s: Timing Tests
|
0.419 s: Timing Tests
|
||||||
0.110 s: Invert
|
0.110 s: Invert
|
||||||
0.110 s: Timing Tests
|
0.110 s: Timing Tests
|
||||||
0.122 s: Transpose
|
0.123 s: Transpose
|
||||||
0.122 s: Timing Tests
|
0.123 s: Timing Tests
|
||||||
0.184 s: Normalize
|
0.189 s: Normalize
|
||||||
0.184 s: Timing Tests
|
0.189 s: Timing Tests
|
||||||
0.006 s: GET ROW
|
0.006 s: GET ROW
|
||||||
0.006 s: Timing Tests
|
0.006 s: Timing Tests
|
||||||
0.232 s: GET COLUMN
|
0.229 s: GET COLUMN
|
||||||
0.232 s: Timing Tests
|
0.229 s: Timing Tests
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 1 | 1 passed
|
test cases: 1 | 1 passed
|
||||||
assertions: - none -
|
assertions: - none -
|
||||||
|
|
||||||
Command being timed: "build/unit-tests/matrix-timing-tests -d yes"
|
Command being timed: "build/unit-tests/matrix-timing-tests -d yes"
|
||||||
User time (seconds): 4.03
|
User time (seconds): 3.98
|
||||||
System time (seconds): 0.00
|
System time (seconds): 0.00
|
||||||
Percent of CPU this job got: 99%
|
Percent of CPU this job got: 99%
|
||||||
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.04
|
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.99
|
||||||
Average shared text size (kbytes): 0
|
Average shared text size (kbytes): 0
|
||||||
Average unshared data size (kbytes): 0
|
Average unshared data size (kbytes): 0
|
||||||
Average stack size (kbytes): 0
|
Average stack size (kbytes): 0
|
||||||
@@ -43,9 +43,9 @@ assertions: - none -
|
|||||||
Maximum resident set size (kbytes): 3200
|
Maximum resident set size (kbytes): 3200
|
||||||
Average resident set size (kbytes): 0
|
Average resident set size (kbytes): 0
|
||||||
Major (requiring I/O) page faults: 184
|
Major (requiring I/O) page faults: 184
|
||||||
Minor (reclaiming a frame) page faults: 174
|
Minor (reclaiming a frame) page faults: 172
|
||||||
Voluntary context switches: 1
|
Voluntary context switches: 1
|
||||||
Involuntary context switches: 53
|
Involuntary context switches: 10
|
||||||
Swaps: 0
|
Swaps: 0
|
||||||
File system inputs: 12
|
File system inputs: 12
|
||||||
File system outputs: 1
|
File system outputs: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user