Skip to content

Commit 22955e9

Browse files
committed
Add regression performance scripts
1 parent cb0c324 commit 22955e9

File tree

52 files changed

+4067
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4067
-0
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Launch the performance test
2+
3+
4+
permissions:
5+
contents: write
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: 'Branch to test'
11+
required: true
12+
default: 'master'
13+
type: string
14+
commit_hash:
15+
description: 'Commit hash on the branch, if not specified thent he latest is taken'
16+
required: false
17+
type: string
18+
repository_dispatch:
19+
20+
21+
jobs:
22+
run:
23+
runs-on: self-hosted
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
with:
28+
path: ./PerformanceRegression
29+
30+
- name: Setup environment
31+
shell: bash
32+
run: |
33+
if [[ "${{ github.event_name}}" == "workflow_dispatch" ]]; then
34+
echo "TEST_BRANCH=${{ inputs.branch }}" | tee -a $GITHUB_ENV
35+
echo "TEST_COMMIT_HASH=${{ inputs.commit_hash }}" | tee -a $GITHUB_ENV
36+
else
37+
echo "TEST_BRANCH=${{ github.event.client_payload.branch }}" | tee -a $GITHUB_ENV
38+
echo "TEST_COMMIT_HASH=${{ github.event.client_payload.commit_hash }}" | tee -a $GITHUB_ENV
39+
fi
40+
41+
- name: Run performance tests
42+
id: run_perf_tests
43+
shell: bash
44+
run: |
45+
export RO_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
46+
bash ./PerformanceRegression/main.sh $(pwd) $TEST_BRANCH $TEST_COMMIT_HASH
47+
48+
- name: Upload artifacts
49+
uses: actions/[email protected]
50+
with:
51+
name: ${{ inputs.branch }}_${{ inputs.commit_hash }}
52+
path: logs
53+
54+
- name: Push results
55+
if: steps.run_perf_tests.outcome == 'success'
56+
run: |
57+
cd PerformanceRegression
58+
git config user.name github-actions
59+
git config user.email [email protected]
60+
git add old_results/*
61+
git commit -m "Add performance stats for $TEST_BRANCH $TEST_COMMIT_HASH"
62+
git pull -r
63+
git push
64+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
3+
*__pycache__/

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Performance regression testing for SOFA
2+
3+
This repository is meant for testing computatioin speed of SOFA Framework. It is constituted of two parts :
4+
1. Scripts to generate computation statistics
5+
2. Script to display the results in a dashboard
6+
7+
The repository serves also as an archive because all te generated results are saved in the folder `old_results` by the action
8+
9+
This plugin has been built to work on Ubuntu, but it might work properly on other OS, it just hasn't been tested.
10+
11+
## Use the action
12+
13+
This script is meant to be launched on a physical self-hosted runner to make sure the running conditions are reproducible. To launch the statistic generation, a workflow-dispatch is available.
14+
Inputs are simple:
15+
1. Sofa branch name (master by default)
16+
2. Commit id (empty by default) --> if none given the tip of the branch is taken
17+
18+
The action is meant to work only with master and releases branches.
19+
The action will then perform the statistic geenration and push them on the repository.
20+
21+
22+
23+
## Use on your own computer
24+
25+
### Statistics generation
26+
27+
#### Dependencies
28+
If you want to run the statistic generation on your own computer, those are the dependencies :
29+
- **SOFA:** Dependencies to build SOFA without openGl, Qt, and no plugin. See https://sofa-framework.github.io/doc/getting-started/build/linux/
30+
- **Tracy:** a compiled version of the tracy-cvsexporter and tracy-capture. Make sure they are the same version of the one used by SOFA and directly accessible (add their directory to your path). If the one from SOFA changes, it might be good to dump the version in the patches (see branch-dependency/git-patches) to be able to still build and test old releases.
31+
- **ccache:** By default ccache is used, it is recommended to have it installed
32+
- **Python3:** Version 3.12 + PyGithub
33+
- **inxi:** to dump hardware info
34+
35+
36+
#### How to
37+
The statistics are run through the `main.sh` script :
38+
39+
*brief:* This script is used to launch the full pipeline of performance testing for one specific commit or branch.
40+
It is parametrized by three files :
41+
- perf.scenes : List of "${scene name} ${starting time step to record} ${nax time step} ${number of scene launch}
42+
- default.timers : timers to be used for statistics for scenes that uses a DefaultAnimationLoop. It allows to redefine the timer name using the syntax TimeNameInStats=TimerNameInSOFA. You can also use simple addition and subtraction of timer names on the right-hand side (e.g : "CollisionDetection=CollisionEndEvent-CollisionBeginEvent" or "ProjectAndMechaMap=ProjectAndPropagateDx+ProjectAndPropagateXAndV"). Subtraction uses timestamp and addition time spawn. This has been added to be able to have a unified notation between those timers an the ones from FreeMotionAnimaitonLoop scenes
43+
- freemotion.timers : Same than the last one but for scenes with FreeMotionAnimationLoop
44+
45+
*inputs:*
46+
- workdir (required): directory used to store all working files. Where folders build, sofa, and output will be created.
47+
- sofa-branch (required): branch to test
48+
- commit-hash (optional): specific commit to test, if none is given, the tip of the branch will be tested.
49+
50+
*env:*
51+
- RO_GITHUB_TOKEN: a read only github token
52+
53+
*outputs:*
54+
- log files in the folder $WORK_DIR/logs
55+
- computed statistic : in a file named after the commit hash with the commit date and time (or the release version if only a branch is given and its name follows the release naming convention vXX.XX). e.g. sha_yyyy-mm-dd_hh-mm-ss.csv. The statistics are formated in a matrix which lines are the scenes names defined in perf.scenes and column are the results of the cartesian product between the timer names present in the files `default.timers` and `freemotion.timers` and all the type of statistics defined in generate_statistics/methods.py:computeSingleData.
56+
- hardware info : hardware information of the computer who generated the results. Same naming convention except that no date or time is added.
57+
58+
Note that the statistic file and hard info file are copied in the repository in folder old_results to be ready to commit them
59+
60+
### Dashboard
61+
If you just want to display the archived results you can only launch the dashboard script in `dashboard/dashboard.py`.
62+
There are two ways of launching it :
63+
1. Using directly python3 to run the script. This will result in a dashoboard being accessible on 127.0.0.1:8050
64+
2. Using docker compose. You'll have two solution, either using the pre generated image by ging in the folder `dashboard/docker/` and running `docker compose up redis` or by building it yourself buy running `docker compose build && docker compose up local`
65+
66+
#### Dependencies
67+
Dependencies depends on how you run it:
68+
1. If runing through python3, you'll need to install all the dependencies in the file `dashboard/docker/requirements.txt` by calling `python3 -m pip install -r requirements.txt`, you can skip `gunicorn`.
69+
2. If runing through docker, you'll need docker desktop and docker compose. See https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
70+

0 commit comments

Comments
 (0)