Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,10 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/

# Local personal workspace and agent artifacts
/.agents/
/.claude/
/local_workspace/
/ultragoal/
/skills-lock.json
1 change: 1 addition & 0 deletions docs/.nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ nav:
- Getting Started:
- getting_started/quickstart.md
- getting_started/installation.md
- getting_started/nvidia-a100-validation/index.md
- Operators:
- operators/README.md
- operators/fused-logp.md
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A100 Smoke Benchmark Notes\n",
"\n",
"This notebook records a lightweight RL-Kernel benchmark validation run on one isolated NVIDIA A100 device. The goal is to make the benchmark process reproducible and to validate whether the generated reports accurately describe the backend that was measured.\n",
"\n",
"Scope:\n",
"\n",
"- Record visible GPU hardware and runtime state.\n",
"- Select exactly one idle A100 with `CUDA_VISIBLE_DEVICES`.\n",
"- Record physical GPU index and logical CUDA mapping.\n",
"- Run a minimal benchmark shape to validate the profiling path.\n",
"- Capture generated CSV/JSON reports.\n",
"- Compare benchmark status fields with runtime logs.\n",
"- Keep latency and throughput observations as smoke diagnostics only.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Benchmark Method\n",
"\n",
"This run uses a smoke-scale configuration. It is intended to validate benchmark wiring and report semantics, not to produce final performance claims.\n",
"\n",
"Method:\n",
"\n",
"- Select one idle physical A100 device with `CUDA_VISIBLE_DEVICES=0`.\n",
"- PyTorch sees the selected physical GPU as logical CUDA device 0.\n",
"- Use a small tensor shape to keep the run quick and easy to repeat.\n",
"- Use `warmup=0` and `repeat=1` for initial validation.\n",
"- Treat latency and throughput values as diagnostic observations only.\n",
"- Use larger shapes and repeated runs before publishing performance numbers.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0, NVIDIA A100 80GB PCIe, 0, 81920, 0\n",
"1, NVIDIA A100 80GB PCIe, 0, 81920, 0\n",
"2, NVIDIA A100 80GB PCIe, 0, 81920, 0\n",
"3, NVIDIA A100 80GB PCIe, 0, 81920, 0\n",
"4, NVIDIA A100 80GB PCIe, 0, 81920, 0\n",
"5, NVIDIA A100 80GB PCIe, 0, 81920, 0\n",
"6, NVIDIA A100 80GB PCIe, 3, 81920, 0\n",
"7, NVIDIA A100 80GB PCIe, 0, 81920, 0\n"
]
}
],
"source": [
"# Check visible GPU state before selecting a device.\n",
"!nvidia-smi --query-gpu=index,name,memory.used,memory.total,utilization.gpu --format=csv,noheader,nounits\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CUDA_VISIBLE_DEVICES 0\n",
"python 3.12.3 (main, Jan 8 2026, 11:30:50) [GCC 13.3.0]\n",
"torch 2.9.1+cu129\n",
"cuda_available True\n",
"cuda_version 12.9\n",
"hip_version None\n",
"device_count 1\n",
"logical_device 0 NVIDIA A100 80GB PCIe (8, 0)\n",
"rocminfo_path None\n"
]
}
],
"source": [
"# Record the one-GPU CUDA mapping used for validation.\n",
"import os, sys, shutil, subprocess\n",
"print('CUDA_VISIBLE_DEVICES', os.environ.get('CUDA_VISIBLE_DEVICES'))\n",
"print('python', sys.version)\n",
"try:\n",
" import torch\n",
" print('torch', torch.__version__)\n",
" print('cuda_available', torch.cuda.is_available())\n",
" print('cuda_version', torch.version.cuda)\n",
" print('hip_version', getattr(torch.version, 'hip', None))\n",
" print('device_count', torch.cuda.device_count())\n",
" for i in range(torch.cuda.device_count()):\n",
" print('logical_device', i, torch.cuda.get_device_name(i), torch.cuda.get_device_capability(i))\n",
"except Exception as exc:\n",
" print('torch_error', repr(exc))\n",
"print('rocminfo_path', shutil.which('rocminfo'))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Smoke Benchmark Command\n",
"\n",
"The command below uses a minimal workload to exercise the benchmark runner, backend registry, CSV writer, and JSON writer. It is useful for checking whether the profiler records the correct backend status before running larger benchmark suites.\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO 06-17 16:56:37 [RL-Kernel]: RL-Engine initialized with NVIDIA CUDA backend (Version: 12.9)\n",
"INFO 06-17 16:56:46 [RL-Kernel]: Profiling 'logp_native' | shape=(2,16,1024)\n",
"INFO 06-17 16:56:46 [RL-Kernel]: KernelRegistry initialized for cuda\n",
"INFO 06-17 16:56:47 [RL-Kernel]: Successfully linked to precompiled _C.fused_logp fallback kernel.\n",
"INFO 06-17 16:56:47 [RL-Kernel]: Profiling 'logp_fused' | shape=(2,16,1024)\n",
"INFO 06-17 16:56:47 [RL-Kernel]: Profiling 'sampling_native' | shape=(2,1024)\n",
"INFO 06-17 16:56:48 [RL-Kernel]: Performance report saved to reports/a100-smoke-stage1/perf_report_NVIDIA_A100_80GB_PCIe_20260617_165648.json\n",
"INFO 06-17 16:56:48 [RL-Kernel]: CSV metrics appended to reports/a100-smoke-stage1/perf_report_NVIDIA_A100_80GB_PCIe.csv\n",
"\n",
"========================================================================================================================\n",
" RL-KERNEL AUTOMATED PERFORMANCE PROFILING SUITE \n",
"GPU: NVIDIA A100 80GB PCIe | Arch: Ampere | Backend: cuda\n",
"========================================================================================================================\n",
"╒═════════════════╤═════════╤══════════╤═════════╤═══════════════╤══════════════╤══════════╤═════════════════╤══════════╕\n",
"│ Benchmark │ Batch │ SeqLen │ Vocab │ Latency(ms) │ Tokens/sec │ TFLOPS │ Peak VRAM(GB) │ Status │\n",
"╞═════════════════╪═════════╪══════════╪═════════╪═══════════════╪══════════════╪══════════╪═════════════════╪══════════╡\n",
"│ logp_native │ 2 │ 16 │ 1024 │ 597.3 │ 54 │ 0 │ 0 │ pass │\n",
"├─────────────────┼─────────┼──────────┼─────────┼───────────────┼──────────────┼──────────┼─────────────────┼──────────┤\n",
"│ logp_fused │ 2 │ 16 │ 1024 │ 3.69 │ 8,671 │ 0 │ 0 │ pass │\n",
"├─────────────────┼─────────┼──────────┼─────────┼───────────────┼──────────────┼──────────┼─────────────────┼──────────┤\n",
"│ sampling_native │ 2 │ 16 │ 1024 │ 1076.81 │ 30 │ 0 │ 0 │ pass │\n",
"╘═════════════════╧═════════╧══════════╧═════════╧═══════════════╧══════════════╧══════════╧═════════════════╧══════════╛\n",
"========================================================================================================================\n",
"\n"
]
}
],
"source": [
"!CUDA_VISIBLE_DEVICES=0 python3 scripts/run_profile_suite.py \\\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the reproducible notebook! One issue: this cell assumes the notebook is executed from the repo root. If someone opens it from docs/getting_started/nvidia-a100-validation, scripts/run_profile_suite.py will not resolve, and the later reports/...csv path has the same problem. Could we add an explicit repo-root setup step, such as %cd ../../.., or make these paths robust?

" --device cuda \\\n",
" --dtype float32 \\\n",
" --batch-sizes 2 \\\n",
" --seq-lens 16 \\\n",
" --vocab-sizes 1024 \\\n",
" --workloads logp-native,logp-fused,sampling-native \\\n",
" --warmup 0 \\\n",
" --repeat 1 \\\n",
" --output-dir reports/a100-smoke-stage1 \\\n",
" --csv \\\n",
" --json\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Equivalent command from the repository root:\n",
"\n",
"```bash\n",
"CUDA_VISIBLE_DEVICES=0 python3 scripts/run_profile_suite.py \\\n",
" --device cuda \\\n",
" --dtype float32 \\\n",
" --batch-sizes 2 \\\n",
" --seq-lens 16 \\\n",
" --vocab-sizes 1024 \\\n",
" --workloads logp-native,logp-fused,sampling-native \\\n",
" --warmup 0 \\\n",
" --repeat 1 \\\n",
" --output-dir reports/a100-smoke-stage1 \\\n",
" --csv \\\n",
" --json\n",
"```\n",
"\n",
"Generated outputs include:\n",
"\n",
"- `perf_report_NVIDIA_A100_80GB_PCIe.csv`\n",
"- `perf_report_NVIDIA_A100_80GB_PCIe_20260617_165648.json`\n",
"\n",
"These generated report artifacts were used for inspection and are not final documentation artifacts.\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
" benchmark_name gpu_name gpu_architecture gpu_backend gpu_compute_capability gpu_device_index batch_size seq_len vocab_size latency_ms tokens_per_sec peak_vram_gb status notes\n",
"0 logp_native NVIDIA A100 80GB PCIe Ampere cuda 8.0 0 2 16 1024 597.303284 53.574124 0.000367 pass NaN\n",
"1 logp_fused NVIDIA A100 80GB PCIe Ampere cuda 8.0 0 2 16 1024 3.690496 8670.921274 0.000246 pass NaN\n",
"2 sampling_native NVIDIA A100 80GB PCIe Ampere cuda 8.0 0 2 16 1024 1076.806641 29.717499 0.000073 pass NaN\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pathlib import Path\n",
"import pandas as pd\n",
"\n",
"csv_path = Path('reports/a100-smoke-stage1/perf_report_NVIDIA_A100_80GB_PCIe.csv')\n",
"df = pd.read_csv(csv_path)\n",
"df[[\n",
" 'benchmark_name',\n",
" 'gpu_name',\n",
" 'gpu_architecture',\n",
" 'gpu_backend',\n",
" 'gpu_compute_capability',\n",
" 'gpu_device_index',\n",
" 'batch_size',\n",
" 'seq_len',\n",
" 'vocab_size',\n",
" 'latency_ms',\n",
" 'tokens_per_sec',\n",
" 'peak_vram_gb',\n",
" 'status',\n",
" 'notes',\n",
"]]\n"
]
},
{
"cell_type": "markdown",
"id": "fznxipa9ag",
"metadata": {},
"source": [
"## Result Summary\n",
"\n",
"This smoke run completed successfully on physical GPU 0, exposed to PyTorch as logical CUDA device 0 through `CUDA_VISIBLE_DEVICES=0`. The machine-readable reports record all three requested workloads as `status = pass`.\n",
"\n",
"The `logp_fused` row should still be interpreted conservatively. The runtime log says `Successfully linked to precompiled _C.fused_logp fallback kernel.`, so this validates that the profiler can execute and report the available `_C.fused_logp` path in this environment. It does not claim a full production fused-kernel benchmark, and the single-iteration smoke timing is not a publishable performance number.\n",
"\n",
"The generated CSV/JSON reports were inspected for status fields and backend metadata. They should remain disposable validation artifacts unless a later stage explicitly promotes them.\n",
"\n",
"## Next Checks\n",
"\n",
"For stricter NVIDIA validation, build the extension and require fused dispatch explicitly:\n",
"\n",
"```bash\n",
"MAX_JOBS=2 python setup.py build_ext --inplace\n",
"python examples/grpo_single_gpu.py \\\n",
" --device cuda \\\n",
" --require-fused-logp \\\n",
" --steps 2 \\\n",
" --num-prompts 1 \\\n",
" --samples-per-prompt 2 \\\n",
" --prompt-len 2 \\\n",
" --completion-len 3 \\\n",
" --vocab-size 16 \\\n",
" --hidden-dim 8\n",
"```\n",
"\n",
"Only report that strict path as validated after running it on the target hardware.\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading