Format source code to PEP8 using Ruff (#36)
* added ruff docs * style: Run ruff and black before yapf pass * yapf -r -i (23 fixes) * fixed conf.py and ran ruff format . * fixed conf.py 2 * formatted argparser.py * formatted src/rocprof_compute_analyze * formatted src/rocprof_compute_profile * formatted soc_base.py * formatted rocprof_compute_tui * formatted gui_components * formatted src/utils * formatted tests/ * format extra files * cleanup * fix test_utils.py * fixed typos * Update pyproject.toml * Update README.md * Update test_utils.py --------- Signed-off-by: jamessiddeley-amd <James.Siddeley@amd.com> Co-authored-by: James Siddeley <James.Siddeley@amd.com> Co-authored-by: systems-assistant[bot] <systems-assistant[bot]@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d3f9ab25eb
Коммит
58d2a016ce
@@ -4,7 +4,8 @@ from contextlib import closing
|
||||
|
||||
from utils.logger import console_error
|
||||
|
||||
# From schema definition in source/share/rocprofiler-sdk-rocpd/data_views.sql in rocprofiler-sdk repository
|
||||
# From schema definition in source/share/rocprofiler-sdk-rocpd/data_views.sql
|
||||
# in rocprofiler-sdk repository
|
||||
COUNTERS_COLLECTION_QUERY = """
|
||||
SELECT
|
||||
agent_id as GPU_ID,
|
||||
@@ -39,9 +40,9 @@ def convert_db_to_csv(
|
||||
with closing(conn.execute(COUNTERS_COLLECTION_QUERY)) as cursor:
|
||||
with open(csv_file_path, "w", newline="") as csvfile:
|
||||
writer = csv.writer(csvfile)
|
||||
writer.writerow(
|
||||
[description[0] for description in cursor.description]
|
||||
)
|
||||
writer.writerow([
|
||||
description[0] for description in cursor.description
|
||||
])
|
||||
for row in cursor:
|
||||
writer.writerow(row)
|
||||
except (sqlite3.DatabaseError, IOError) as e:
|
||||
@@ -50,22 +51,21 @@ def convert_db_to_csv(
|
||||
|
||||
def process_rocpd_csv(df):
|
||||
"""
|
||||
Merge counters across unique dispatches from the input dataframe and return processed dataframe.
|
||||
Merge counters across unique dispatches from the
|
||||
input dataframe and return processed dataframe.
|
||||
"""
|
||||
# Only import pandas if needed
|
||||
import pandas as pd
|
||||
|
||||
data = list()
|
||||
# Group by unique kernel and merge into a single row
|
||||
for _, group_df in df.groupby(
|
||||
[
|
||||
"Dispatch_ID",
|
||||
"Kernel_Name",
|
||||
"Grid_Size",
|
||||
"Workgroup_Size",
|
||||
"LDS_Per_Workgroup",
|
||||
]
|
||||
):
|
||||
for _, group_df in df.groupby([
|
||||
"Dispatch_ID",
|
||||
"Kernel_Name",
|
||||
"Grid_Size",
|
||||
"Workgroup_Size",
|
||||
"LDS_Per_Workgroup",
|
||||
]):
|
||||
row = {
|
||||
"GPU_ID": group_df["GPU_ID"].iloc[0],
|
||||
"Grid_Size": group_df["Grid_Size"].iloc[0],
|
||||
@@ -80,7 +80,8 @@ def process_rocpd_csv(df):
|
||||
}
|
||||
# Each counter will become its own column
|
||||
row.update(dict(zip(group_df["Counter_Name"], group_df["Counter_Value"])))
|
||||
# Replace end timestamp with median of durations of group, start timestamp is set to 0
|
||||
# Replace end timestamp with median of durations of group,
|
||||
# start timestamp is set to 0
|
||||
row["End_Timestamp"] = (
|
||||
group_df["End_Timestamp"] - group_df["Start_Timestamp"]
|
||||
).median()
|
||||
|
||||
Ссылка в новой задаче
Block a user