-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continous Benchmarking Action (#1137)
* ci: continous benchmarking action * fix pytorch install command * fixed action python version * added github token to benchmark action * test message worst performance * ci: test gh-pages results from cb action * ci: this should pass * fix: typo * remove cache action in favor of gh-pages * extra / * ci: action config should work now * extra benchmarks from linalg module * quicker linalg benchmarks * cluster benchmarks, removed some code duplication * corrected cb workflow command * ci: split cb workflow into a main and pr. pr workflow triggers with a 'run bench' comment * ci: bench pr runs after a review is requested * ci: bench now only triggers on pull requests with 'PR talk' tag * ci: reshape benchmark, removed cronjob from pytorch workflows, renamed 'old' benchmarking folder to '2020' * mend * fix: missing import in cb main * ci: changed benchmark python version to 3.10, added shield in readme pointing to the benchmarks, changed trigger tag * fix: incorrect python version param --------- Co-authored-by: Claudia Comito <39374113+ClaudiaComito@users.noreply.github.com>
- Loading branch information
1 parent
9f6b2eb
commit 02d2492
Showing
56 changed files
with
322 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Benchmark main and save | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
benchmark-main: | ||
name: Benchmark main and save | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup MPI | ||
uses: mpi4py/setup-mpi@v1 | ||
- name: Use Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10.11 # Perun only supports 3.8 and ahead | ||
architecture: x64 | ||
- name: Test | ||
run: | | ||
pip install torch==1.12.1+cpu torchvision==0.13.1+cpu torchaudio==0.12.1 -f https://download.pytorch.org/whl/torch_stable.html | ||
pip install .[cb] | ||
PERUN_RUN_ID=N4 mpirun -n 4 python benchmarks/cb/main.py | ||
jq -s flatten bench_data/*.json > bench_data/all_benchmarks.json | ||
- name: Save benchmark result and update gh-pages-chart | ||
if: ${{github.ref == 'refs/heads/main'}} | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
# Benchmark action input and output | ||
tool: 'customSmallerIsBetter' | ||
output-file-path: bench_data/all_benchmarks.json | ||
# external-data-json-path: ./cache/benchmark-data.json | ||
# Alert configuration | ||
fail-on-alert: false # Don't fail on main branch | ||
comment-on-alert: true | ||
# Save benchmarks from the main branch | ||
save-data-file: true | ||
# Pages configuration | ||
auto-push: true | ||
gh-pages-branch: gh-pages | ||
benchmark-data-dir-path: dev/bench | ||
# Upload the updated cache file for the next job by actions/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Benchmark PR | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled] | ||
branches: [main] | ||
|
||
jobs: | ||
benchmark-pr: | ||
name: Benchmark PR | ||
if: contains(github.event.pull_request.labels.*.name, 'benchmark PR') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup MPI | ||
uses: mpi4py/setup-mpi@v1 | ||
- name: Use Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10.11 # Perun only supports 3.8 and ahead | ||
architecture: x64 | ||
- name: Test | ||
run: | | ||
pip install torch==1.12.1+cpu torchvision==0.13.1+cpu torchaudio==0.12.1 -f https://download.pytorch.org/whl/torch_stable.html | ||
pip install .[cb] | ||
PERUN_RUN_ID=N4 mpirun -n 4 python benchmarks/cb/main.py | ||
jq -s flatten bench_data/*.json > bench_data/all_benchmarks.json | ||
- name: Compare benchmark result | ||
if: ${{github.ref != 'refs/heads/main'}} | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
# Benchmark action input and output | ||
tool: 'customSmallerIsBetter' | ||
output-file-path: bench_data/all_benchmarks.json | ||
# external-data-json-path: ./cache/benchmark-data.json | ||
# Alert configuration | ||
fail-on-alert: true | ||
comment-on-alert: true | ||
# Ignore results from non main branches. | ||
save-data-file: false | ||
# Pages configuration | ||
auto-push: false | ||
gh-pages-branch: gh-pages | ||
benchmark-data-dir-path: dev/bench |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -305,3 +305,5 @@ MANIFEST | |
travis_wait_*.log | ||
testing.py | ||
heat/datasets/MNISTDataset | ||
perun_results/ | ||
bench_data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[output] | ||
format = bench | ||
data_out = ./bench_data | ||
|
||
[benchmarking] | ||
bench_enable = True | ||
bench_rounds = 10 | ||
bench_warmup_rounds = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import heat as ht | ||
from perun.decorator import monitor | ||
|
||
|
||
@monitor() | ||
def kmeans_cpu(data): | ||
kmeans = ht.cluster.KMeans(n_clusters=4, init="kmeans++") | ||
kmeans.fit(data) | ||
|
||
|
||
@monitor() | ||
def kmedians_cpu(data): | ||
kmeans = ht.cluster.KMedians(n_clusters=4, init="kmedians++") | ||
kmeans.fit(data) | ||
|
||
|
||
@monitor() | ||
def kmedoids_cpu(data): | ||
kmeans = ht.cluster.KMedoids(n_clusters=4, init="kmedoids++") | ||
kmeans.fit(data) | ||
|
||
|
||
n = 5000 | ||
seed = 1 | ||
data = ht.utils.data.spherical.create_spherical_dataset( | ||
num_samples_cluster=n, radius=1.0, offset=4.0, dtype=ht.float32, random_state=seed | ||
) | ||
kmeans_cpu(data) | ||
kmedians_cpu(data) | ||
kmedoids_cpu(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# flake8: noqa | ||
import heat as ht | ||
from perun.decorator import monitor | ||
|
||
|
||
@monitor() | ||
def matmul_cpu_split_0(n: int = 3000): | ||
a = ht.random.random((n, n), split=0, device="cpu") | ||
b = ht.random.random((n, n), split=0, device="cpu") | ||
a @ b | ||
|
||
|
||
@monitor() | ||
def matmul_cpu_split_1(n: int = 3000): | ||
a = ht.random.random((n, n), split=1, device="cpu") | ||
b = ht.random.random((n, n), split=1, device="cpu") | ||
a @ b | ||
|
||
|
||
@monitor() | ||
def qr_cpu(n: int = 2000): | ||
for t in range(1, 3): | ||
for sp in range(2): | ||
a = ht.random.random((n, n), split=sp) | ||
qr = a.qr(tiles_per_proc=t) | ||
|
||
|
||
@monitor() | ||
def lanczos_cpu(n: int = 50): | ||
A = ht.random.random((n, n), dtype=ht.float64, split=0) | ||
B = A @ A.T | ||
V, T = ht.lanczos(B, m=n) | ||
|
||
|
||
matmul_cpu_split_0() | ||
matmul_cpu_split_1() | ||
qr_cpu() | ||
lanczos_cpu() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# flake8: noqa | ||
import linalg | ||
import cluster | ||
import manipulations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# flake8: noqa | ||
import heat as ht | ||
from perun.decorator import monitor | ||
|
||
|
||
@monitor() | ||
def reshape_cpu(): | ||
sizes = [10000, 20000, 40000] | ||
for size in sizes: | ||
st = ht.zeros((1000, size), split=1) | ||
a = ht.reshape(st, (10000000, -1), new_split=1) | ||
|
||
|
||
reshape_cpu() |
Oops, something went wrong.