Skip to content

Commit

Permalink
Merge pull request #3 from ilastik/graphs
Browse files Browse the repository at this point in the history
generate results
  • Loading branch information
k-dominik committed Aug 29, 2024
2 parents 8f80e78 + 49217a6 commit b015819
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: generate results

on:
push:
branches: [ main ]


jobs:
generate-results:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install jinja2 pandas pytz seaborn
- run: python generate-results.py
- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
add: 'Results.md *.png'
author_name: ilastik-bot
committer_name: ilastik bot
message: '(bot) Updated results'
new_branch: results
push: 'origin results --force'
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ python bench-bincount.py --hostname MyCoolComputer
This will add your results to the `results-unique.csv` and `results-bincount.csv` table.

Please open a PR and contribute your results :)

**--> [Link to current results](https://github.com/ilastik/unique-bincount-benchmark/blob/results/Results.md) <--**
24 changes: 24 additions & 0 deletions Results.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Results

generated {{ now }}, from results of {{ n_hosts }} machines

## Unique

### Memory usage

![unique-memory-usage](unique-max-memory.png)

### Time

![unique-runningtime](unique-runningtime.png)

## Bincount

### Memory usage

![bincount-memory-usage](bincount-max-memory.png)

### Time

![bincount-runningtime](bincount-runningtime.png)

75 changes: 75 additions & 0 deletions generate-results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import datetime
from datetime import timedelta, timezone
from pathlib import Path

import pandas
import pytz
import seaborn as sns
from jinja2 import Template

utctzinfo = timezone(timedelta(hours=0))
timeformat = "%Y-%m-%dT%H:%M:%S"


def gen_plots():
shape_index_mapping = {
"(512, 128, 1)": "0", # numpy.prod((512, 128, 1)),
"(1024, 512, 1)": "1", # numpy.prod((1024, 512, 1)),
"(2048, 1024, 1)": "2", # numpy.prod((2048, 1024, 1)),
"(512, 512, 32)": "3", # numpy.prod((512, 512, 32)),
"(1024, 1024, 256)": "4", # numpy.prod((1024, 1024, 256))
}

results_unique = pandas.read_csv("results-unique.csv", sep="\t")

results_unique["shape_ind"] = results_unique["shape"].map(shape_index_mapping)

p = sns.lineplot(x="shape_ind", y="t", hue="method", data=results_unique)
p.set(yscale="log")
fig = p.get_figure()
fig.savefig("unique-runningtime.png")

p.clear()

p = sns.lineplot(x="shape_ind", y="mem_max", hue="method", data=results_unique)
p.set(yscale="log")
fig = p.get_figure()
fig.savefig("unique-max-memory.png")

p.clear()

results_bincount = pandas.read_csv("results-bincount.csv", sep="\t")

results_bincount["shape_ind"] = results_bincount["shape"].map(shape_index_mapping)

p = sns.lineplot(x="shape_ind", y="t", hue="method", data=results_bincount)
p.set(yscale="log")
fig = p.get_figure()
fig.savefig("bincount-runningtime.png")

p.clear()

p = sns.lineplot(x="shape_ind", y="mem_max", hue="method", data=results_bincount)
p.set(yscale="log")
fig = p.get_figure()
fig.savefig("bincount-max-memory.png")

p.clear()


def main():
template = Template(Path("Results.md.in").read_text())
gen_plots()
n_hosts = len(pandas.read_csv("results-unique.csv", sep="\t")["host"].unique())

tz = pytz.timezone("Europe/Berlin")
now = datetime.datetime.now(tz)

# render
rendered = template.render(now=now.strftime(timeformat), n_hosts=n_hosts)

Path("Results.md").write_text(rendered)


if __name__ == "__main__":
main()

0 comments on commit b015819

Please sign in to comment.