Files
2026-07-13 13:23:29 +08:00

2.7 KiB
Raw Permalink Blame History

--json-model-override-args

--load-format dummy

Pytorch Profiler

教程:

  1. https://pytorch.org/tutorials/prototype/numeric_suite_tutorial.html
  2. https://pytorch.org/tutorials/intermediate/fx_profiling_tutorial.html

NVIDIA Nsight Systems

参考资料:

属于系统级性能分析工具,提供从全局视角对整个系统的性能进行监控和分析,包括 CPU、GPU、内存、IO 等多种硬件资源的使用情况,以及它们之间的交互信息。

使用 --python-backtrace=cuda 查看所有 CUDA 内核的 python 调用堆栈,就像在 PyTorch Profiler 中一样。(注意:这可能会导致基于 CUDA 事件的计时的内核运行时间不准确)

chrome://tracing

python -m sglang.bench_serving --backend sglang --model meta-llama/Llama-3.1-8B-Instruct --num-prompts 2 --sharegpt-output-len 100 --profile

NVIDIA Nsight Compute

专注于 GPU 内核级的性能分析,主要针对 CUDA 应用程序,深入到 GPU 内部,分析 CUDA 内核的执行情况。

NVIDIA Tools Extension LibraryNVTX

通过使用NVTX,开发者可以在代码中添加注释,这些注释可以被NVIDIA的开发工具识别,从而在性能分析和调试过程中提供帮助。

pip install nvtx
# example_lib.py

import time
import nvtx


def sleep_for(i):
    time.sleep(i)

@nvtx.annotate()
def my_func():
    time.sleep(1)

with nvtx.annotate("for_loop", color="green"):
    for i in range(5):
        sleep_for(i)
        my_func()

nsys profile python demo.py