Skip to content

Commit

Permalink
docs: update parsing of system definitions for table
Browse files Browse the repository at this point in the history
move existing table to a legacy catalog of systems
  • Loading branch information
slabasan committed Jan 27, 2025
1 parent cbe1579 commit 4d2a417
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 15 deletions.
5 changes: 4 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ help:
systemconfigs:
./generate-sys-defs-list.py

legacysystemconfigs:
./generate-legacy-sys-defs-list.py

tags:
./generate-benchmark-list.py $(WORKSPACE_PATH)

.PHONY: help systemconfigs tags Makefile
.PHONY: help legacysystemconfigs systemconfigs 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 @@ -10,6 +10,13 @@
import sys
import os

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

subprocess.call(
[
"make",
Expand Down
63 changes: 63 additions & 0 deletions docs/generate-legacy-sys-defs-list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env python3

import glob

import pandas as pd
import yaml


def main():
sysconfig_yaml_files = glob.glob(
"../legacy/systems/**/system_definition.yaml", recursive=True
)

df_list = []
for f in sysconfig_yaml_files:
with open(f, "r") as stream:
try:
data = yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)

tmp_df = pd.json_normalize(data, max_level=2)
df_list.append(tmp_df)

df = pd.concat(df_list)

# Data formatting: converts system-tested.description yaml value to rst
# format for external links
df.loc[
df["system_definition.system-tested.description"].notna(),
"system_definition.system-tested.description",
] = (
"`"
+ df.loc[
df["system_definition.system-tested.description"].notna(),
"system_definition.system-tested.description",
].astype(str)
+ "`_"
)

# Data formatting: converts top500-system-instances yaml list to rst string
# of strings (ideally to put 1 per line)
list_of_strings = []
for i in df["system_definition.top500-system-instances"]:
list_of_strings.append(", ".join(item for item in i if item))
df.loc[:, "system_definition.top500-system-instances"] = list_of_strings

# Remove system_definition from all field names
# (e.g., system_definition.system-tested.description)
df.columns = df.columns.str.removeprefix("system_definition.")

# Replace NaN with empty string
df.fillna("", inplace=True)

# Set index to be field names
df.set_index("name", inplace=True)

# Write out current system definitions to CSV format
df.to_csv("legacy-current-system-definitions.csv")


if __name__ == "__main__":
main()
28 changes: 14 additions & 14 deletions docs/generate-sys-defs-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def main():
sysconfig_yaml_files = glob.glob(
"../legacy/systems/**/system_definition.yaml", recursive=True
"../systems/all_system_definitions/**/system_definition.yaml", recursive=True
)

df_list = []
Expand All @@ -24,19 +24,19 @@ def main():

df = pd.concat(df_list)

# Data formatting: converts system-tested.description yaml value to rst
# format for external links
df.loc[
df["system_definition.system-tested.description"].notna(),
"system_definition.system-tested.description",
] = (
"`"
+ df.loc[
df["system_definition.system-tested.description"].notna(),
"system_definition.system-tested.description",
].astype(str)
+ "`_"
)
# # Data formatting: converts system-tested.description yaml value to rst
# # format for external links
# df.loc[
# df["system_definition.system-tested.description"].notna(),
# "system_definition.system-tested.description",
# ] = (
# "`"
# + df.loc[
# df["system_definition.system-tested.description"].notna(),
# "system_definition.system-tested.description",
# ].astype(str)
# + "`_"
# )

# Data formatting: converts top500-system-instances yaml list to rst string
# of strings (ideally to put 1 per line)
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@
:caption: Legacy Workflow

legacy-getting-started
legacy-system-list
18 changes: 18 additions & 0 deletions docs/legacy-system-list.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. 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
=====================
System Specifications
=====================

The table below provides a directory of information for systems that have been
specified in Benchpark. The column headers in the table below are available for
use as the ``system`` parameter in ``benchpark setup``.

.. csv-table:: Legacy System Specifications in Benchpark.
:class: datatable
:file: legacy-current-system-definitions.csv
:header-rows: 1
:align: left

0 comments on commit 4d2a417

Please sign in to comment.