From b7b1b8abd2e4c6ebf691b43913295b87912d8565 Mon Sep 17 00:00:00 2001 From: Taekyung Heo <7621438+TaekyungHeo@users.noreply.github.com> Date: Fri, 24 May 2024 13:57:35 -0700 Subject: [PATCH] Generate CSV report in NCCL test --- .../nccl_test/report_generation_strategy.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/cloudai/schema/test_template/nccl_test/report_generation_strategy.py b/src/cloudai/schema/test_template/nccl_test/report_generation_strategy.py index 1d3a1d4bc..621ad079b 100644 --- a/src/cloudai/schema/test_template/nccl_test/report_generation_strategy.py +++ b/src/cloudai/schema/test_template/nccl_test/report_generation_strategy.py @@ -19,6 +19,7 @@ import pandas as pd from cloudai.report_generator.tool.bokeh_report_tool import BokehReportTool +from cloudai.report_generator.tool.csv_report_tool import CSVReportTool from cloudai.report_generator.util import add_human_readable_sizes from cloudai.schema.core.strategy import ReportGenerationStrategy, StrategyRegistry from cloudai.schema.system import SlurmSystem @@ -76,7 +77,8 @@ def generate_report(self, test_name: str, directory_path: str, sol: Optional[flo df["Algbw (GB/s) In-place"] = df["Algbw (GB/s) In-place"].astype(float) df["Busbw (GB/s) In-place"] = df["Busbw (GB/s) In-place"].astype(float) df = add_human_readable_sizes(df, "Size (B)", "Size Human-readable") - self._generate_plots(test_name, df, directory_path, sol) + self._generate_bokeh_report(test_name, df, directory_path, sol) + self._generate_csv_report(df, directory_path) def _parse_output(self, directory_path: str) -> Tuple[List[List[str]], Optional[float]]: """ @@ -99,7 +101,9 @@ def _parse_output(self, directory_path: str) -> Tuple[List[List[str]], Optional[ return data, avg_bus_bw return [], None - def _generate_plots(self, test_name: str, df: pd.DataFrame, directory_path: str, sol: Optional[float]) -> None: + def _generate_bokeh_report( + self, test_name: str, df: pd.DataFrame, directory_path: str, sol: Optional[float] + ) -> None: """ Create and saves plots to visualize NCCL test metrics. @@ -138,3 +142,15 @@ def _generate_plots(self, test_name: str, df: pd.DataFrame, directory_path: str, ) report_tool.finalize_report("cloudai_nccl_test_bokeh_report.html") + + def _generate_csv_report(self, df: pd.DataFrame, directory_path: str) -> None: + """ + Generate a CSV report from the DataFrame. + + Args: + df (pd.DataFrame): DataFrame containing the NCCL test data. + directory_path (str): Output directory path for saving the CSV report. + """ + csv_report_tool = CSVReportTool(directory_path) + csv_report_tool.set_dataframe(df) + csv_report_tool.finalize_report("cloudai_nccl_test_csv_report.csv")