From 15fe336269d6b8ac91400e753caea1371953ebf3 Mon Sep 17 00:00:00 2001 From: Ralph Liu Date: Mon, 26 Aug 2024 11:41:24 -0700 Subject: [PATCH] Add metadata --- benchmarks/nx-cugraph/pytest-based/README.md | 7 +- .../create_results_summary_page.py | 75 +++++++++++++------ 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/benchmarks/nx-cugraph/pytest-based/README.md b/benchmarks/nx-cugraph/pytest-based/README.md index c5044d06406..fff1c46a44d 100644 --- a/benchmarks/nx-cugraph/pytest-based/README.md +++ b/benchmarks/nx-cugraph/pytest-based/README.md @@ -21,7 +21,7 @@ Our current benchmarks provide the following datasets: #### 1. `run-gap-benchmarks.sh` This script allows users to run selected algorithms across multiple datasets and backends. All results are stored inside a sub-directory (`logs/`) and named based on the combination of params for that benchmark. -**Usage:** +**Usage:** ```bash bash run-gap-benchmarks.sh # edit this script directly ``` @@ -29,7 +29,7 @@ This script allows users to run selected algorithms across multiple datasets and #### 2. `get_graph_bench_dataset.py` This script downloads the specified dataset using `cugraph.datasets`. -**Usage:** +**Usage:** ```bash python get_graph_bench_dataset.py [dataset] ``` @@ -37,8 +37,7 @@ This script downloads the specified dataset using `cugraph.datasets`. #### 3. `create_results_summary_page.py` This script is designed to be run after `run-gap-benchmarks.sh` in order to generate an HTML page displaying a results table. -**Usage:** +**Usage:** ```bash python create_results_summary_page.py > report.html ``` - diff --git a/benchmarks/nx-cugraph/pytest-based/create_results_summary_page.py b/benchmarks/nx-cugraph/pytest-based/create_results_summary_page.py index 5ed16a5cd75..7aca631f11a 100644 --- a/benchmarks/nx-cugraph/pytest-based/create_results_summary_page.py +++ b/benchmarks/nx-cugraph/pytest-based/create_results_summary_page.py @@ -15,6 +15,10 @@ import re import pathlib import json +import platform +import psutil +import socket +import subprocess def compute_perf_vals(cugraph_runtime, networkx_runtime): @@ -34,6 +38,42 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime): return (speedup_string, delta_string) +def get_system_info(): + print(f"

Hostname : {socket.gethostname()}

") + print( + f'

Operating System: {platform.system()} {platform.release()}

' + ) + print(f'

Kernel Version : {platform.version()}

') + with open("/proc/cpuinfo") as f: + print( + f'

CPU : {next(line.strip().split(": ")[1] for line in f if "model name" in line)} ({psutil.cpu_count(logical=False)} cores)

' + ) + print( + f'

Memory : {round(psutil.virtual_memory().total / (1024 ** 3), 2)} GB

' + ) + try: + gpu_info = ( + subprocess.check_output( + "nvidia-smi --query-gpu=name,memory.total,memory.free,memory.used --format=csv,noheader", + shell=True, + ) + .decode() + .strip() + ) + if gpu_info: + gpus = gpu_info.split("\n") + num_gpus = len(gpus) + first_gpu = gpus[0] # Get the information for the first GPU + gpu_name, mem_total, _, _ = first_gpu.split(",") + print( + f"

GPU : {num_gpus} x {gpu_name.strip()} ({round(int(mem_total.strip().split()[0]) / (1024), 2)} GB)

" + ) + else: + print("

No GPU found or unable to query GPU details.

") + except subprocess.CalledProcessError: + print("

Failed to execute nvidia-smi. No GPU information available.

") + + if __name__ == "__main__": logs_dir = pathlib.Path("logs") @@ -84,8 +124,9 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime): backend = "networkx" runtime = benchmark_run["stats"]["mean"] - benchmarks.setdefault(algo_name, {}).setdefault(backend, {})[dataset] = runtime - # breakpoint() + benchmarks.setdefault(algo_name, {}).setdefault(backend, {})[ + dataset + ] = runtime # dump HTML table ordered_datasets = [ @@ -123,19 +164,12 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime): .footer { background-color: #f1f1f1; padding: 10px; - text-align: center; - font-size: 14px; - color: #333; - left: 0; - bottom: 0; + font-size: 12px; + color: black; width: 100%; } - .footer a { - color: #007bff; - text-decoration: none; - } - .footer a:hover { - text-decoration: underline; + .text-indent { + text-indent: 20px; /* Indents the first line of the text by 30px */ } @@ -153,7 +187,6 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime): """ ) - for algo_name in benchmarks: algo_runs = benchmarks[algo_name] print(" ") @@ -172,7 +205,8 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime): cugraph_runtime = cugraph_algo_runs[dataset] networkx_runtime = networkx_algo_runs[dataset] (speedup, runtime_delta) = compute_perf_vals( - cugraph_runtime=cugraph_runtime, networkx_runtime=networkx_runtime + cugraph_runtime=cugraph_runtime, + networkx_runtime=networkx_runtime, ) print(f" {speedup}
{runtime_delta}") else: @@ -188,11 +222,8 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime): print( """ - - - - - """ + \n + \n""")