Skip to content

Commit

Permalink
Add metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-rliu committed Aug 26, 2024
1 parent 52e13fa commit 15fe336
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 26 deletions.
7 changes: 3 additions & 4 deletions benchmarks/nx-cugraph/pytest-based/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,23 @@ 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
```

#### 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]
```

#### 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
```

75 changes: 53 additions & 22 deletions benchmarks/nx-cugraph/pytest-based/create_results_summary_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -34,6 +38,42 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime):
return (speedup_string, delta_string)


def get_system_info():
print(f"<p>Hostname : {socket.gethostname()}</p>")
print(
f'<p class="text-indent"">Operating System: {platform.system()} {platform.release()}</p>'
)
print(f'<p class="text-indent">Kernel Version : {platform.version()}</p>')
with open("/proc/cpuinfo") as f:
print(
f'<p>CPU : {next(line.strip().split(": ")[1] for line in f if "model name" in line)} ({psutil.cpu_count(logical=False)} cores)</p>'
)
print(
f'<p class="text-indent">Memory : {round(psutil.virtual_memory().total / (1024 ** 3), 2)} GB</p>'
)
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"<p>GPU : {num_gpus} x {gpu_name.strip()} ({round(int(mem_total.strip().split()[0]) / (1024), 2)} GB)</p>"
)
else:
print("<p>No GPU found or unable to query GPU details.</p>")
except subprocess.CalledProcessError:
print("<p>Failed to execute nvidia-smi. No GPU information available.</p>")


if __name__ == "__main__":
logs_dir = pathlib.Path("logs")

Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 */
}
</style>
</head>
Expand All @@ -153,7 +187,6 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime):
"""
)


for algo_name in benchmarks:
algo_runs = benchmarks[algo_name]
print(" <tr>")
Expand All @@ -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" <td>{speedup}<br>{runtime_delta}</td>")
else:
Expand All @@ -188,11 +222,8 @@ def compute_perf_vals(cugraph_runtime, networkx_runtime):

print(
"""
</tbody>
</table>
<div class="footer">
</div>
</html>
"""
</tbody>\n</table>
<div class="footer">"""
)
get_system_info()
print("""</div>\n</html>""")

0 comments on commit 15fe336

Please sign in to comment.