Skip to content

Commit 505429b

Browse files
update nsys chapter in user_guide
1 parent 4441bfa commit 505429b

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

docs/zh/user_guide.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -798,46 +798,46 @@ solver = ppsci.solver.Solver(
798798
799799
## 3. 使用 Nsight 进行性能分析
800800
801-
Nsight是NVIDIA面相开发者提供的开发工具套件,能提供深入的跟踪、调试、评测和分析,以优化跨 NVIDIA GPU和CPU的复杂计算应用程序。
801+
Nsight是NVIDIA面相开发者提供的开发工具套件,能提供深入的跟踪、调试、评测和分析,以优化跨 NVIDIA GPU和CPU的复杂计算应用程序。详细文档可参考:[Nsight Systems Document](https://docs.nvidia.com/nsight-systems/index.html)
802802
803-
PaddleScience 初步支持使用 Nsight 进行性能分析,以 linux 开发环境为例,按照如下步骤进行
803+
PaddleScience 初步支持使用 Nsight 进行性能分析,以 linux 开发环境 + laplace2d 案例为例,按照如下步骤使用 nsight 工具生成性能分析报告并查看分析结果
804804
805-
1. 安装 nsight 工具
805+
1. 安装 nsight-system
806806
807-
开发机上下载 linux nsight-system 软件:nsight-systems/2023.4.1,并添加到环境变量 `PATH` 中:`PATH=/nsight-systems/2023.4.1/bin:$PATH`,并在 windows 机器下载并安装 nsight-system 软件
807+
开发机上下载 linux nsight-system 软件:nsight-systems/2023.4.1,并将 nsight 添加到环境变量 `PATH` 中:
808+
809+
执行:`PATH=/path/to/nsight-systems/2023.4.1/bin:$PATH`,同时在 windows 机器上安装**相同版本**的 nsight-system 软件。
808810
809811
2. 用 nsys 命令运行程序,生成性能分析文件
810812
811813
``` sh
812-
{++NVTX=1 nsys profile -t cuda,nvtx --stats=true -o laplace2d++} python laplace2d.py
814+
{==NVTX=1 nsys profile -t cuda,nvtx --stats=true -o==} {++laplace2d++} python laplace2d.py
813815
```
814816
815-
详细文档可参考:[Nsight Systems Document](https://docs.nvidia.com/nsight-systems/index.html)
816-
817817
3. 查看分析结果
818818
819-
程序结束后,在终端内会打印出性能分析数据如下所示
819+
程序结束后,在终端内会打印出性能分析数据如下所示),同时在上述 `-o` 参数指定的相对文件路径生成 `{++laplace2d++}.nsys-rep` 和 `{++laplace2d++}.sqlite` 两个文件。
820820
821-
``` log
822-
...
823-
...
824-
Only run 25 steps when 'NVTX' is set in environment for nsight analysis. Exit now ......
825-
Generating '/tmp/nsys-report-18e4.qdstrm'
826-
[1/7] [========================100%] laplace2d.nsys-rep
827-
[2/7] [========================100%] laplace2d.sqlite
828-
[3/7] Executing 'nvtx_sum' stats report
829-
830-
Time (%) Total Time (ns) Instances Avg (ns) Med (ns) Min (ns) Max (ns) StdDev (ns) Style Range
831-
-------- --------------- --------- ------------- ------------- ----------- ----------- ------------- ------- ------------------------------------
832-
15.1 794,212,341 25 31,768,493.6 5,446,410.0 5,328,471 661,841,104 131,265,333.9 PushPop Loss computation
833-
14.5 766,452,142 25 30,658,085.7 4,369,873.0 4,281,927 659,795,434 131,070,475.4 PushPop Constraint EQ
834-
13.0 687,324,359 1,300 528,711.0 32,567.5 21,218 641,625,892 17,794,532.4 PushPop matmul dygraph
835-
12.9 678,475,194 1 678,475,194.0 678,475,194.0 678,475,194 678,475,194 0.0 PushPop Training iteration 1
836-
12.8 673,614,062 1,300 518,164.7 19,802.5 14,499 641,525,121 17,792,027.2 PushPop matmul compute
837-
3.9 203,945,648 25 8,157,825.9 8,029,819.0 7,797,185 9,119,496 359,173.3 PushPop Loss backward
838-
...
839-
...
840-
```
821+
在 windows 上使用 NVIDIA Nsight Systems 软件打开 `laplace2d.nsys-rep`,即可在图形化的界面上查看性能分析数据。
841822
842-
其次会在程序运行的目录下,生成 `laplace2d.nsys-rep` 和 `laplace2d.sqlite` 两个文件,在 windows 上使用 NVIDIA Nsight Systems 软件打开 `laplace2d.nsys-rep`,
843-
即可在图形化的界面上查看性能分析数据。
823+
``` log
824+
...
825+
...
826+
Only run 25 steps when 'NVTX' is set in environment for nsight analysis. Exit now ......
827+
828+
Generating '/tmp/nsys-report-18e4.qdstrm'
829+
[1/7] [========================100%] laplace2d.nsys-rep
830+
[2/7] [========================100%] laplace2d.sqlite
831+
[3/7] Executing 'nvtx_sum' stats report
832+
833+
Time (%) Total Time (ns) Instances Avg (ns) Med (ns) Min (ns) Max (ns) StdDev (ns) Style Range
834+
-------- --------------- --------- ------------- ------------- ----------- ----------- ------------- ------- ------------------------------------
835+
15.1 794,212,341 25 31,768,493.6 5,446,410.0 5,328,471 661,841,104 131,265,333.9 PushPop Loss computation
836+
14.5 766,452,142 25 30,658,085.7 4,369,873.0 4,281,927 659,795,434 131,070,475.4 PushPop Constraint EQ
837+
13.0 687,324,359 1,300 528,711.0 32,567.5 21,218 641,625,892 17,794,532.4 PushPop matmul dygraph
838+
12.9 678,475,194 1 678,475,194.0 678,475,194.0 678,475,194 678,475,194 0.0 PushPop Training iteration 1
839+
12.8 673,614,062 1,300 518,164.7 19,802.5 14,499 641,525,121 17,792,027.2 PushPop matmul compute
840+
3.9 203,945,648 25 8,157,825.9 8,029,819.0 7,797,185 9,119,496 359,173.3 PushPop Loss backward
841+
...
842+
...
843+
```

ppsci/solver/train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def train_epoch_func(solver: "solver.Solver", epoch_id: int, log_freq: int):
176176
if solver.global_step >= NVTX_STOP_ITER:
177177
print(
178178
f"Only run {NVTX_STOP_ITER} steps when 'NVTX' is set in environment"
179-
" for nsight analysis. Exit now ......"
179+
" for nsight analysis. Exit now ......\n"
180180
)
181181
core.nvprof_stop()
182182
sys.exit(0)

0 commit comments

Comments
 (0)