

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Debugger 分析报告演练
<a name="debugger-profiling-report-walkthrough"></a>

本节将向您逐个介绍 Debugger 分析报告中的不同部分。分析报告根据内置的监控和分析规则生成。报告仅显示发现了问题的规则的结果图。

**重要**  
报告中提供的图表和建议仅供参考，并不确保准确无误。您应负责对其中的信息进行单独评测。

**Topics**
+ [训练作业摘要](#debugger-profiling-report-walkthrough-summary)
+ [系统使用情况统计数据](#debugger-profiling-report-walkthrough-system-usage)
+ [框架指标摘要](#debugger-profiling-report-walkthrough-framework-metrics)
+ [规则摘要](#debugger-profiling-report-walkthrough-rules-summary)
+ [分析训练循环 – 步骤持续时间](#debugger-profiling-report-walkthrough-step-durations)
+ [GPU 利用率分析](#debugger-profiling-report-walkthrough-gpu-utilization)
+ [批次大小](#debugger-profiling-report-walkthrough-batch-size)
+ [CPU 瓶颈](#debugger-profiling-report-walkthrough-cpu-bottlenecks)
+ [I/O 瓶颈](#debugger-profiling-report-walkthrough-io-bottlenecks)
+ [多 GPU 训练中的负载均衡](#debugger-profiling-report-walkthrough-workload-balancing)
+ [GPU 内存分析](#debugger-profiling-report-walkthrough-gpu-memory)

## 训练作业摘要
<a name="debugger-profiling-report-walkthrough-summary"></a>

在报告的开头，Debugger 会提供训练作业的摘要。在此部分中，您可以概要了解不同训练阶段的持续时间和时间戳。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-summary.gif)


概要表包含以下信息：
+ **start\$1time** – 启动训练作业的确切时间。
+ **end\$1time** – 完成训练作业的确切时间。
+ **job\$1duration\$1in\$1seconds** – 从 **start\$1time** 到 **end\$1time** 的训练总时间。
+ **training\$1loop\$1start** – 启动第一个纪元的第一个步骤的确切时间。
+ **training\$1loop\$1end** – 完成最后一个纪元的最后一个步骤的确切时间。
+ **training\$1loop\$1duration\$1in\$1seconds** – 训练循环开始时间与训练循环结束时间所隔的总时间。
+ **initialization\$1in\$1seconds** – 初始化训练作业所用的时间。初始化阶段涵盖从 **start\$1time** 到 **training\$1loop\$1start** 时间之间的时段。初始化时间用于编译训练脚本、启动训练脚本、创建和初始化模型、启动 EC2 实例和下载训练数据。
+ **finalization\$1in\$1seconds** – 完成训练作业所花费的时间，例如完成模型训练、更新模型构件和关闭 EC2 实例。完成阶段涵盖从 **training\$1loop\$1end** 时间到 **end\$1time** 之间的时段。
+ **initialization (%)** – 用在 **initialization** 上的时间占总 **job\$1duration\$1in\$1seconds** 的百分比。
+ **training loop (%)** – 用在 **training loop** 上的时间占总 **job\$1duration\$1in\$1seconds** 的百分比。
+ **finalization (%)** – 用在 **finalization** 上的时间占总 **job\$1duration\$1in\$1seconds** 的百分比。

## 系统使用情况统计数据
<a name="debugger-profiling-report-walkthrough-system-usage"></a>

在此部分中，您可以查看系统利用率统计数据概览。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-system-usage.png)


Debugger 分析报告包含以下信息：
+ **节点** – 列出节点的名称。如果在多个节点（多个 EC2 实例）上使用分布式训练，则节点名称的格式为 `algo-n`。
+ **指标** – Debugger 收集的系统指标：CPU、GPU、CPU 内存、GPU 内存、I/O 和网络指标。
+ **单位** – 指标的单位。
+ **最大值** – 每个系统指标的最大值。
+ **p99** – 每个系统使用情况的第 99 个百分位数。
+ **p95** – 每个系统使用情况的第 95 个百分位数。
+ **p50** – 每个系统使用情况的第 50 个百分位数（中位数）。
+ **最小值** – 每个系统指标的最小值。

## 框架指标摘要
<a name="debugger-profiling-report-walkthrough-framework-metrics"></a>

在本节中，以下饼图显示了 CPUs 和的框架操作细分 GPUs。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-framework-metrics-summary.gif)


每个饼图分析所收集框架指标的各个方面，如下所示：
+ 阶段@@ **与其他 TRAIN/EVAL 阶段之间的比**率 — 显示在不同训练阶段所花费的时间之间的比率。
+ **向前和向后传递之间的比率** – 显示训练循环中前向和向后传递所花费时间之间的比率。
+ ** CPU/GPU 运算符之间的比率** — 显示在 CPU 或 GPU 上运行的运算符（例如卷积运算符）上所花费的时间之间的比率。
+ **框架中记录的一般指标** – 显示在主要框架指标（例如数据加载、向前和向后传递）上所花费时间之间的比率。

### 概述：CPU 运算符
<a name="debugger-profiling-report-walkthrough-cpu-operators"></a>

此部分详细介绍 CPU 运算符的信息。表中显示了在最频繁调用的 CPU 运算符上所花费时间的百分比和绝对累计时间。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-framework-cpu-operators.gif)


### 概述：GPU 运算符
<a name="debugger-profiling-report-walkthrough-gpu-operators"></a>

此部分详细介绍 GPU 运算符的信息。表中显示了在最频繁调用的 GPU 运算符上所花费时间的百分比和绝对累计时间。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-framework-gpu-operators.gif)


## 规则摘要
<a name="debugger-profiling-report-walkthrough-rules-summary"></a>

在此部分中，Debugger 汇总了所有规则评估结果、分析、规则描述和建议。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-rules-summary.png)


## 分析训练循环 – 步骤持续时间
<a name="debugger-profiling-report-walkthrough-step-durations"></a>

在此部分中，您可以找到每个节点每个 GPU 核心步骤持续时间的详细统计信息。Debugger 评估步骤持续时间的平均值、最大值、p99、p95、p50 和最小值，并计算步骤异常值。以下直方图显示了在不同工作节点上捕获的步骤持续时间和。 GPUs您可以通过在右侧选择图例来启用或禁用各个 Worker 的直方图。您可以检查是否有特定 GPU 导致步骤持续时间异常。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-framework-step-duration.gif)


## GPU 利用率分析
<a name="debugger-profiling-report-walkthrough-gpu-utilization"></a>

本节显示基于低GPUUtilization 规则的 GPU 内核利用率的详细统计信息。它还汇总了 GPU 利用率统计数据，即平均值、p95 和 p5，以确定训练作业的利用率是否不足。 GPUs

## 批次大小
<a name="debugger-profiling-report-walkthrough-batch-size"></a>

此部分显示了 CPU 总利用率、单个 GPU 利用率和 GPU 内存占用量的详细统计数据。该 BatchSize 规则决定了您是否需要更改批量大小以更好地利用 GPUs。您可以检查批次大小是否太小而导致利用率不足，还是过大而导致利用率过高和内存不足问题。在图中，方框显示相对于中位数 (p50) 的 p25 和 p75 百分位数范围（分别填充深紫色和亮黄色），误差条形显示第 5 个百分位数作为下限，第 95 个百分位数作为上限。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-batch-size.png)


## CPU 瓶颈
<a name="debugger-profiling-report-walkthrough-cpu-bottlenecks"></a>

在本节中，您可以深入研究 CPUBottleneck 规则从您的训练作业中检测到的 CPU 瓶颈。该规则检查 CPU 使用率是否高于 `cpu_threshold`（默认值为 90%）以及 GPU 利用率是否低于 `gpu_threshold`（默认值为 10%）。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-cpu-bottlenecks.png)


饼图显示以下信息：
+ **CPU 瓶颈导致的低 GPU 使用率** – 显示 GPU 利用率高于和低于阈值的数据点与符合 CPU 瓶颈标准的数据点之间的比率。
+ 阶段@@ **与其他 TRAIN/EVAL 阶段之间的比**率 — 显示在不同训练阶段所花费的时间之间的比率。
+ **向前和向后传递之间的比率** – 显示训练循环中前向和向后传递所花费时间之间的比率。
+ ** CPU/GPU 运算符之间的比率**-显示在 Python 运算符（例如数据加载器进程以及向前 GPUs 和 CPUs 向后传递运算符）上花费的时间间隔之间的比率。
+ **框架中记录的一般指标** – 显示主要框架指标以及在指标上所花费时间的比率。

## I/O 瓶颈
<a name="debugger-profiling-report-walkthrough-io-bottlenecks"></a>

在本节中，您可以找到 I/O 瓶颈的摘要。该规则评估 I/O 等待时间和 GPU 利用率，并监控在等待数据从存储到达的I/O requests exceeds a threshold percent of the total training time. It might indicate I/O瓶颈上花费的时间。 GPUs 

## 多 GPU 训练中的负载均衡
<a name="debugger-profiling-report-walkthrough-workload-balancing"></a>

在本节中，您可以确定工作负载平衡问题 GPUs。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-workload-balancing.gif)


## GPU 内存分析
<a name="debugger-profiling-report-walkthrough-gpu-memory"></a>

在本节中，您可以分析 GPUMemory增加规则收集的 GPU 内存利用率。在图中，方框显示相对于中位数 (p50) 的 p25 和 p75 百分位数范围（分别填充深紫色和亮黄色），误差条形显示第 5 个百分位数作为下限，第 95 个百分位数作为上限。

![\[Debugger 分析报告示例\]](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/debugger/debugger-profiling-report-gpu-memory-utilization.png)
