Nsys CLI 分析指南

问题描述 投票:0回答:2

我刚刚进入 CUDA 开发世界,现在正在尝试分析我的代码。预计运行

nvprof
工具进行分析,但出现以下错误:

======== Warning: This version of nvprof doesn't support the underlying device, GPU profiling skipped

搜索了一下,发现

nvprof
是遗留的,所有分析现在都应该使用 Nsight Systems CLI 完成。运行
nsys nvprof ./myapp
时会生成 2 个文件:
report1.nsys-rep
report1.sqlite
。我如何利用这些来获取有关我的代码的分析信息?

环境:

WSL 与 Ubunutu 20.04

NVIDIA Nsight 系统版本 2023.1.2.43-32377213v0

Nvprof:发布版本10.1.243 (21)

NVCC:Cuda编译工具,版本10.1,V10.1.243

我希望获得与使用

nvprof
类似的信息:

我只尝试过这个命令进行分析:

nsys nvprof ./myapp
。希望了解它是否是正确的一种或您可能拥有的其他更好的变体。

输出

nsys profile --stats=true ./diverged

Generating '/tmp/nsys-report-04e5.qdstrm'
[1/8] [========================100%] report2.nsys-rep
[2/8] [========================100%] report2.sqlite
[3/8] Executing 'nvtx_sum' stats report
SKIPPED: .../sum_reduction/report2.sqlite does not contain NV Tools Extension (NVTX) data.
[4/8] Executing 'osrt_sum' stats report

 Time (%)  Total Time (ns)  Num Calls   Avg (ns)    Med (ns)   Min (ns)  Max (ns)   StdDev (ns)       Name
 --------  ---------------  ---------  ----------  ----------  --------  ---------  -----------  --------------
     74.7        364907400          6  60817900.0  72485919.0   4489170  100201745   42231058.9  poll
     24.3        118728446        345    344140.4     81962.0       541   10034413    1039273.8  ioctl
      0.6          2840826          9    315647.3    449904.0      2254     535093     236455.8  read
      0.2           920219          2    460109.5    460109.5    105991     814228     500799.2  sem_timedwait
      0.1           471795          2    235897.5    235897.5     70382     401413     234074.3  pthread_create
      0.1           310682         25     12427.3      8907.0      2785      95078      18330.8  mmap
      0.0            84580          9      9397.8     10049.0      1473      15419       4316.1  open
      0.0            80611         13      6200.8      4559.0      1382      17002       5451.1  fopen
      0.0            65704          3     21901.3     21310.0     20649      23745       1630.5  write
      0.0            48833         26      1878.2        70.5        60      46898       9182.3  fgets
      0.0            18413          6      3068.8      1738.0      1182       8455       2815.7  fclose
      0.0             8245          1      8245.0      8245.0      8245       8245          0.0  pipe2
      0.0             7233          2      3616.5      3616.5      1853       5380       2494.0  munmap
      0.0             6662          5      1332.4      1533.0       351       1853        579.3  fcntl

[5/8] Executing 'cuda_api_sum' stats report
SKIPPED: .../sum_reduction/report2.sqlite does not contain CUDA trace data.
[6/8] Executing 'cuda_gpu_kern_sum' stats report
SKIPPED: .../sum_reduction/report2.sqlite does not contain CUDA kernel data.
[7/8] Executing 'cuda_gpu_mem_time_sum' stats report
SKIPPED: .../sum_reduction/report2.sqlite does not contain GPU memory data.
[8/8] Executing 'cuda_gpu_mem_size_sum' stats report
SKIPPED: .../sum_reduction/report2.sqlite does not contain GPU memory data.
cuda profiling nsight nvprof nsight-systems
2个回答
2
投票

nvprof
是一个遗留工具,不会接收新功能。最好切换到 Nsight Systems 或 Nsight Compute,具体取决于您的分析目标。

除非您有特定的分析目标,否则建议的分析策略是从 Nsight Systems 开始,以确定系统瓶颈并识别对性能影响最大的内核。第二步,您可以使用 Nsight Compute 来分析已识别的内核并找到优化它们的方法。

如果您熟悉

nvprof
并想继续使用它,Nsight Systems 支持
nvprof
命令,您可以在文档部分从 NVIDIA
nvprof
或从
nsys nvprof --help
迁移。

运行 nsys nvprof ./myapp 时,会生成 2 个文件:report1.nsys-rep 和 report1.sqlite。我如何利用这些来获取有关我的代码的分析信息?

关于

.nsys-rep
文件的使用,您可以使用 Nsight Systems GUI 查看其内容,适用于 Windows、Linux (x86_64、SBSA)、Mac。这意味着您可以在目标计算机上收集配置文件并共享它并在其他计算机上查看它。例如,您可以下载 Windows Host 来安装 GUI。

您可以使用

nsys stats
[3] 和
nsys analyze
[4] 命令在终端上提取分析信息。后两个命令可以接收
.nsys-rep
文件或
.sqlite
文件作为输入。

.sqlite
文件也可以用作传统的数据库文件,这可能是更高级的用例所需要的。


0
投票

您需要运行类似

nsys profile -t cuda ./test
的内容来进行 cuda 分析

© www.soinside.com 2019 - 2024. All rights reserved.