Skip to content

Commit

Permalink
docs: update parsing of benchmarks/experiments for table
Browse files Browse the repository at this point in the history
move existing table to a legacy catalog of benchmarks/experiments
  • Loading branch information
slabasan committed Jan 25, 2025
1 parent 943352b commit ddf9834
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ legacysystemconfigs:
tags:
./generate-benchmark-list.py $(WORKSPACE_PATH)

.PHONY: help legacysystemconfigs systemconfigs tags Makefile
legacytags:
./generate-legacy-benchmark-list.py $(WORKSPACE_PATH)

.PHONY: help legacysystemconfigs systemconfigs legacytags tags Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
]
)

subprocess.call(
[
"make",
"legacytags",
]
)

subprocess.call(
[
"make",
Expand Down
2 changes: 1 addition & 1 deletion docs/generate-benchmark-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def construct_tag_groups(tag_groups, tag_dicts, dictionary):


def benchpark_benchmarks(benchmarks):
experiments_dir = "../legacy/experiments"
experiments_dir = "../experiments"
for x in os.listdir(experiments_dir):
benchmarks.append(f"{x}")
return benchmarks
Expand Down
94 changes: 94 additions & 0 deletions docs/generate-legacy-benchmark-list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env python3

import pandas as pd
import yaml
import os
import sys
import subprocess


def construct_tag_groups(tag_groups, tag_dicts, dictionary):
# everything is a dict
for k, v in dictionary.items():
if isinstance(v, list):
tag_groups.append(k)
tag_dicts[k] = v
else:
print("ERROR in construct_tag_groups")


def benchpark_benchmarks(benchmarks):
experiments_dir = "../legacy/experiments"
for x in os.listdir(experiments_dir):
benchmarks.append(f"{x}")
return benchmarks


def main(workspace):
benchmarks = list()
benchpark_benchmarks(benchmarks)

f = "../taxonomy.yaml"
with open(f, "r") as stream:
try:
data = yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)

tag_groups = []
tag_dicts = {}
for k, v in data.items():
if k == "benchpark-tags":
construct_tag_groups(tag_groups, tag_dicts, v)
else:
print("ERROR in top level construct_tag_groups")

main = dict()

tags_taggroups = {}
for bmark in benchmarks:
tags_taggroups[bmark] = {}
for k, v in tag_dicts.items():
tags_taggroups[bmark][k] = []

for bmark in benchmarks:
# call benchpark tags -a bmark workspace
cmd = ["../bin/benchpark", "tags", "-a", bmark, workspace]
try:
byte_data = subprocess.run(cmd, capture_output=True, check=True)
except subprocess.CalledProcessError as e:
print(f"Failed cmd: {cmd}\nOutput: {e.stdout}\nError: {e.stderr}")
raise
tags = str(byte_data.stdout, "utf-8")
tags = (
tags.replace("[", "")
.replace("]", "")
.replace("'", "")
.replace(" ", "")
.replace("\n", "")
.split(",")
)
for t in tags:
for k, v in tag_dicts.items():
if t in v:
print("appending", t, "at key", k)
tags_taggroups[bmark][k].append(t)
main[bmark] = tags_taggroups[bmark]

df = pd.DataFrame(main)
df.to_csv("legacy-benchmark-list.csv")

#################
# Tables
# columns: benchmarks (i.e., amg2023)
# rows: tag groups (i.e., application domain). Each cell should hopefully have a tag - and some might have multiple


if __name__ == "__main__":
try:
workspace = sys.argv[1]
except IndexError:
print("Usage: " + os.path.basename(__file__) + " <workspace>")
sys.exit(1)

main(workspace)
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@

legacy-getting-started
legacy-system-list
legacy-benchmark-list
13 changes: 13 additions & 0 deletions docs/legacy-benchmark-list.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. Copyright 2023 Lawrence Livermore National Security, LLC and other
Benchpark Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: Apache-2.0
==========================
Benchmarks and Experiments
==========================

.. csv-table:: Current Benchpark tags by Benchmark and tag groups.
:file: legacy-benchmark-list.csv
:header-rows: 1
:align: left

0 comments on commit ddf9834

Please sign in to comment.