Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bench5 #33

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
93fb089
Initial commit
atharva-2001 Mar 8, 2023
8904b1c
Comment old benchmarks temporarily
atharva-2001 Mar 17, 2023
f8fb484
Add timeout
atharva-2001 Mar 17, 2023
ac99c71
Change the tests workflow to run benchmarks
atharva-2001 Mar 20, 2023
d19b17b
Replace ASV config file by template one, make changes there, modify t…
atharva-2001 Mar 27, 2023
f25d369
Change the tests workflow back
atharva-2001 Mar 29, 2023
a2d20e2
Change token
atharva-2001 Mar 30, 2023
8942ba3
reduce the number of packets
atharva-2001 Apr 7, 2023
7d64f2e
change config again
atharva-2001 Apr 7, 2023
28eb478
Change config again
atharva-2001 Apr 7, 2023
8277f7b
Remove environment
atharva-2001 Apr 13, 2023
02395be
Fix paths
atharva-2001 Apr 13, 2023
8e89893
Display comment
atharva-2001 Apr 13, 2023
ddc2de6
Try PAT
atharva-2001 Apr 13, 2023
aa31c29
Bot token
atharva-2001 Apr 13, 2023
1b8530c
asv continuous fails sporadically, continue-on-error temporarily
atharva-2001 Apr 13, 2023
e333e42
Rename asv directory to benchmarks
atharva-2001 Apr 14, 2023
fa3a44d
Try running for 5 commits
atharva-2001 Apr 14, 2023
e3aa565
Change branch on my workflow
atharva-2001 Apr 14, 2023
a4d1526
asv -> benchmarks
atharva-2001 Apr 14, 2023
140128d
Clean up benchmarks workflow
atharva-2001 Apr 14, 2023
fdb38fb
Move publish to separate step
atharva-2001 Apr 14, 2023
693fa34
do not show logs and progress bars
atharva-2001 Apr 14, 2023
66e0b7a
Change branch in asv config file
atharva-2001 Apr 14, 2023
828e5b8
Fix commits in asv cont.
atharva-2001 Apr 14, 2023
c0bdfb9
Set target directory in push-to-another-repo
atharva-2001 Apr 14, 2023
04bc7dd
Change trigger to pull request and push on master
atharva-2001 Apr 17, 2023
3a41f33
Delete commented permissions
atharva-2001 Apr 17, 2023
ec27009
Modify the comment, trigger via [bench] word
atharva-2001 Apr 17, 2023
255ab0a
Send comments via github actions
atharva-2001 Apr 18, 2023
05565a6
Download atom data via URL
atharva-2001 Apr 18, 2023
1788944
Atom data version
atharva-2001 Apr 18, 2023
20299f1
Use Actions instead of github scripts
atharva-2001 Apr 18, 2023
4c046e9
Use bot token
atharva-2001 Apr 18, 2023
4b88612
change triggers [skip ci]
atharva-2001 Apr 18, 2023
202dcba
github context: check
atharva-2001 Apr 19, 2023
dfe913a
pull_request_target to pull_request
atharva-2001 Apr 19, 2023
40c48cf
change branch to master
atharva-2001 Apr 19, 2023
f9b4718
asv publish conditional statement
atharva-2001 Apr 19, 2023
0bc5a91
move delete env files
atharva-2001 Apr 19, 2023
91d15b2
revert temporary changes made in tests workflow and the env file
atharva-2001 Apr 19, 2023
1242151
change to fetch-depth:0
atharva-2001 Apr 19, 2023
62db512
asv machine accept all questions
atharva-2001 Apr 19, 2023
0ac99ae
Only one os is sufficient
atharva-2001 Apr 20, 2023
d6e9756
Check if benchmarks failed without showing stderr
atharva-2001 Apr 20, 2023
2e08f7c
change destination repo for results
atharva-2001 Apr 20, 2023
d53d5aa
pull request on any branch
atharva-2001 Apr 20, 2023
09a7a5f
Prevent tests from running on forks
atharva-2001 Apr 26, 2023
434473f
ccache
atharva-2001 Apr 26, 2023
ff3c7c2
token
atharva-2001 Apr 26, 2023
50725c9
env problem
atharva-2001 Apr 26, 2023
2c9c79a
run agaain
atharva-2001 Apr 26, 2023
b8c73e3
ccache not saved
atharva-2001 Apr 26, 2023
4dba800
Run workflows
atharva-2001 Apr 27, 2023
caf6595
save all asv data as artifact for testing
atharva-2001 Apr 27, 2023
a864018
compare
atharva-2001 Apr 28, 2023
2af1659
checkkout v3
atharva-2001 Apr 28, 2023
420692a
bench more
atharva-2001 Apr 28, 2023
0a4d97a
Significantly changed benchmarks
atharva-2001 May 1, 2023
9a11894
needs spaces
atharva-2001 May 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: benchmarks

on:
push:
branches:
- master
pull_request:
branches:
- '*'
types:
- opened
- reopened
- synchronize
- labeled # run-benchmarks label required

defaults:
run:
shell: bash -l {0}

jobs:
build:
if: github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'run-benchmarks')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Atom Data
run: |
REPO_URL="https://dev.azure.com/tardis-sn/TARDIS/_apis/git/repositories/tardis-refdata"
wget -q "$REPO_URL/items?path=atom_data/kurucz_cd23_chianti_H_He.h5&versionType=branch&version=master&resolveLfs=true" -O benchmarks/data/kurucz_cd23_chianti_H_He.h5

- name: Install asv
run: pip install asv

- name: Accpet all asv questions
run: asv machine --yes

- name: Run benchmarks for last 5 commits if not PR
if: github.event_name != 'pull_request'
run: |
git log -n 5 --pretty=format:"%H" >> tag_commits.txt
asv run HASHFILE:tag_commits.txt | tee asv-output.log
if grep -q failed asv-output.log; then
echo "Some benchmarks have failed!"
exit 1
fi

- name: Generate Graphs and HTML
if: github.event_name != 'pull_request'
run: asv publish

- name: Push results to results repository
if: github.event_name != 'pull_request'
continue-on-error: true
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB}}
with:
source-directory: .asv
destination-github-username: tardis-sn
destination-repository-name: tardis-benchmarks
user-email: tardis.sn.bot@gmail.com
target-branch: main
target-directory: .asv

- name: Compare HEAD with master if PR
if: github.event_name == 'pull_request'
continue-on-error: true # TODO: step failed sporadically while testing
run: |
asv continuous ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | tee asv-cont-output.log
if grep -q failed asv-output.log; then
echo "Some benchmarks have errors!"
exit 1
fi

- run: asv compare ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | tee asv-compare-output.log
- run: asv compare ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --only-changed | tee asv-compare-changed-output.log

- name: asv output 1
id: asv_pr_vs_master
uses: juliangruber/read-file-action@v1.0.0
with:
path: asv-compare-output.log

- name: asv output 2
id: asv_pr_vs_master_changed
uses: juliangruber/read-file-action@v1.0.0
with:
path: asv-compare-changed-output.log

# - name: Output logs for comment
# id: asv_logs
# run: |
# EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
# echo "text<<$EOF" >> $GITHUB_OUTPUT
# echo "$(cat asv-output.log)" >> $GITHUB_OUTPUT
# echo "$EOF" >> $GITHUB_OUTPUT


- name: Find Comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'tardis-bot'
body-includes: I ran benchmarks as you asked

- name: Post comment
if: github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ secrets.API_TOKEN_GITHUB}}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
*\*beep\* \*bop\**
Hi human,
I ran benchmarks as you asked comparing master (${{ github.event.pull_request.base.sha }}) and the latest commit (${{ github.event.pull_request.head.sha }}).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts [**here**](${{ env.URL }}).
Significantly changed benchmarks:
<details>

```diff
${{ steps.asv_pr_vs_master_changed.outputs.content }}
```

</details>

All benchmarks:
<details>

```diff
${{ steps.asv_pr_vs_master.outputs.content }}
```

</details>
env:
URL: https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }}?check_suite_focus=true

- name: Delete env files
run: rm -r .asv/env

- name: Save results artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: asv-benchmark-results-${{ runner.os }}
path: |
.asv/results
asv-cont-output.log
asv-compare-output.log
asv-compare-changed-output.log


2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defaults:

jobs:
build:

if: github.repository_owner == 'tardis-sn'
strategy:
matrix:
include:
Expand Down
184 changes: 184 additions & 0 deletions asv.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
// The version of the config file format. Do not change, unless
// you know what you are doing.
"version": 1,

// The name of the project being benchmarked
"project": "tardis",

// The project's homepage
"project_url": "https://tardis-sn.github.io/tardis",

// The URL or local path of the source code repository for the
// project being benchmarked
"repo": ".",

// The Python project's subdirectory in your repo. If missing or
// the empty string, the project is assumed to be located at the root
// of the repository.
// "repo_subdir": "",

// Customizable commands for building, installing, and
// uninstalling the project. See asv.conf.json documentation.
//
"install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"],
"uninstall_command": ["return-code=any python -mpip uninstall -y {project}"],
"build_command": [
"python setup.py build",
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
],

// List of branches to benchmark. If not provided, defaults to "master"
// (for git) or "default" (for mercurial).
"branches": ["master"], // for git
// "branches": ["default"], // for mercurial

// The DVCS being used. If not set, it will be automatically
// determined from "repo" by looking at the protocol in the URL
// (if remote), or by looking for special directories, such as
// ".git" (if local).
// "dvcs": "git",

// The tool to use to create environments. May be "conda",
// "virtualenv" or other value depending on the plugins in use.
// If missing or the empty string, the tool will be automatically
// determined by looking for tools on the PATH environment
// variable.
"environment_type": "conda",

// timeout in seconds for installing any dependencies in environment
// defaults to 10 min
//"install_timeout": 600,

// the base URL to show a commit for the project.
"show_commit_url": "https://github.com/tardis-sn/tardis/commit",

// The Pythons you'd like to test against. If not provided, defaults
// to the current version of Python used to run `asv`.
// "pythons": ["2.7", "3.6"],

// The list of conda channel names to be searched for benchmark
// dependency packages in the specified order
// "conda_channels": ["conda-forge", "defaults"],

// A conda environment file that is used for environment creation.
"conda_environment_file": "tardis_env3.yml",

// The matrix of dependencies to test. Each key of the "req"
// requirements dictionary is the name of a package (in PyPI) and
// the values are version numbers. An empty list or empty string
// indicates to just test against the default (latest)
// version. null indicates that the package is to not be
// installed. If the package to be tested is only available from
// PyPi, and the 'environment_type' is conda, then you can preface
// the package name by 'pip+', and the package will be installed
// via pip (with all the conda available packages installed first,
// followed by the pip installed packages).
//
// The ``@env`` and ``@env_nobuild`` keys contain the matrix of
// environment variables to pass to build and benchmark commands.
// An environment will be created for every combination of the
// cartesian product of the "@env" variables in this matrix.
// Variables in "@env_nobuild" will be passed to every environment
// during the benchmark phase, but will not trigger creation of
// new environments. A value of ``null`` means that the variable
// will not be set for the current combination.
//
// "matrix": {
// "req": {
// "numpy": [],
// "six": ["", null], // test with and without six installed
// "pip+emcee": [""] // emcee is only available for install with pip.
// },
// "env": {"ENV_VAR_1": ["val1", "val2"]},
// "env_nobuild": {"ENV_VAR_2": ["val3", null]},
// },

// Combinations of libraries/python versions can be excluded/included
// from the set to test. Each entry is a dictionary containing additional
// key-value pairs to include/exclude.
//
// An exclude entry excludes entries where all values match. The
// values are regexps that should match the whole string.
//
// An include entry adds an environment. Only the packages listed
// are installed. The 'python' key is required. The exclude rules
// do not apply to includes.
//
// In addition to package names, the following keys are available:
//
// - python
// Python version, as in the *pythons* variable above.
// - environment_type
// Environment type, as above.
// - sys_platform
// Platform, as in sys.platform. Possible values for the common
// cases: 'linux2', 'win32', 'cygwin', 'darwin'.
// - req
// Required packages
// - env
// Environment variables
// - env_nobuild
// Non-build environment variables
//
// "exclude": [
// {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows
// {"environment_type": "conda", "req": {"six": null}}, // don't run without six on conda
// {"env": {"ENV_VAR_1": "val2"}}, // skip val2 for ENV_VAR_1
// ],
//
// "include": [
// // additional env for python2.7
// {"python": "2.7", "req": {"numpy": "1.8"}, "env_nobuild": {"FOO": "123"}},
// // additional env if run on windows+conda
// {"platform": "win32", "environment_type": "conda", "python": "2.7", "req": {"libpython": ""}},
// ],

// The directory (relative to the current directory) that benchmarks are
// stored in. If not provided, defaults to "benchmarks"
"benchmark_dir": "benchmarks",

// The directory (relative to the current directory) to cache the Python
// environments in. If not provided, defaults to "env"
"env_dir": ".asv/env",

// The directory (relative to the current directory) that raw benchmark
// results are stored in. If not provided, defaults to "results".
"results_dir": ".asv/results",

// The directory (relative to the current directory) that the html tree
// should be written to. If not provided, defaults to "html".
"html_dir": ".asv/html",

// The number of characters to retain in the commit hashes.
// "hash_length": 8,

// `asv` will cache results of the recent builds in each
// environment, making them faster to install next time. This is
// the number of builds to keep, per environment.
// "build_cache_size": 2,

// The commits after which the regression search in `asv publish`
// should start looking for regressions. Dictionary whose keys are
// regexps matching to benchmark names, and values corresponding to
// the commit (exclusive) after which to start looking for
// regressions. The default is to start from the first commit
// with results. If the commit is `null`, regression detection is
// skipped for the matching benchmark.
//
// "regressions_first_commits": {
// "some_benchmark": "352cdf", // Consider regressions only after this commit
// "another_benchmark": null, // Skip regression detection altogether
// },

// The thresholds for relative change in results, after which `asv
// publish` starts reporting regressions. Dictionary of the same
// form as in ``regressions_first_commits``, with values
// indicating the thresholds. If multiple entries match, the
// maximum is taken. If no entry matches, the default is 5%.
//
// "regressions_thresholds": {
// "some_benchmark": 0.01, // Threshold of 1%
// "another_benchmark": 0.5, // Threshold of 50%
// },
}
11 changes: 0 additions & 11 deletions asv/asv.conf.json

This file was deleted.

Loading