Skip to content

Commit

Permalink
generate results
Browse files Browse the repository at this point in the history
  • Loading branch information
k-dominik committed Aug 29, 2024
1 parent 92cbdb7 commit 8419d1e
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: generate results

on:
push:
branches: [ main ]
pull_request:
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: '--force'
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

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

### Time

[![unique-runningtime](unique-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 8419d1e

Please sign in to comment.