本文介绍了Nvidia视觉工作室Nsight CPU和GPU调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NVIDIA Nsight Visual Studio Edition似乎不能同时调试CPU(主机代码)和GPU(CUDA代码)。使用Nsight Eclipse版本(或cuda-gdb),这很简单,例如,您可以从主机执行步入CUDA内核。如何使用Visual Studio?

The NVIDIA Nsight Visual Studio Edition does not seem to be capable of debugging CPU (host code) and GPU (cuda code) at the same time. With the Nsight Eclipse Edition (or cuda-gdb) this is quite simple, for example, you can "step in" to a CUDA kernel from the host execution. How to do the same with Visual Studio?

推荐答案

它说

因此,要调试CUDA应用程序,请执行以下步骤:

So to debug a CUDA application here are the steps:


  1. 打开Visual Studio(VS实例#1)并设置断点一个CUDA内核并单击启动CUDA调试。

  2. 打开Visual Studio(VS实例#2)的另一个实例(由于某种原因需要以管理员身份运行),并附加

  3. 在VS实例#2中,浏览到要执行CPU调试的文件并设置断点。

  4. 在VS实例#1中继续执行(应该脱离当前的CUDA内核)。此时,您在VS实例#2中设置的CPU断点应该被触发。

  1. Open Visual Studio (VS instance #1) and set a breakpoint in a CUDA kernel and click "Start CUDA Debugging." This will start the application instance and stop where u set the breakpoint.
  2. Open another instance of Visual Studio (VS instance #2) (needs to be run as admin for some reason) and attach to the process you started in step 1.
  3. In VS instance #2 browse to the file you wish to do your CPU debugging and set a breakpoint.
  4. In VS instance #1 continue the execution (should fall out of the current CUDA kernel). At this point the CPU breakpoint you set in VS instance #2 should be hit.






额外功劳:远程调试CUDA应用程序。
步骤:


Extra credit: Debugging your CUDA application remotely.Steps:


  1. 在目标计算机上以管理员身份运行msvsmon.exe(远程调试器)。可以在
    C:\Program Files(x86)\ Microsoft Visual Studio 11.0 \Common7 \IDE\Remote Debugger \x64找到。

  2. 主机(要从中控制调试的机器),打开VS并确保Nsight调试器指向远程机器(Nsight用户属性>启动>连接名称)。注意:Nvidia Nsight监视器必须在目标计算机上运行才能正常工作。

  3. 从上一个(非远程调试)部分执行步骤1和2。在第2步中,您需要指向远程机器进行CPU调试(调试>附加到过程>限定符应设置为目标机器名或IP)。

  4. 非远程调试步骤3和4也适用于此。

  1. On the target machine run the msvsmon.exe (remote debugger) as admin. This can be found atC:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64.
  2. On the host machine (the one from which you want to control the debugging), open VS and make sure the Nsight debugger is pointed to the remote machine (Nsight User Properties > Launch > Connection Name). NOTE: the Nvidia Nsight monitor must be running on the target machine for this to work.
  3. Do steps 1 and 2 from the previous (non-remote debugging) section. In step 2 you will need to point to the remote machine for CPU debugging (Debug>Attach to Process>Qualifier should be set to the target machine name or IP).
  4. The non-remote debugging steps 3 and 4 apply apply here as well.

注意:看起来VS的远程CPU调试不如其本地CPU调试那么有效。例如,当您将鼠标悬停在CPU变量上时,其值不会像您在进行本地调试时所期望的那样显示。

NOTE: It looks as if VS's remote CPU debugging is not as capable as its local CPU debugging. For example, when you mouse-over CPU variables, there values to not appear as you would expect when you are doing local debugging.

STILL未发送:是否可以在打开CUDA断点之前开始调试主机代码?这似乎是一个很大的限制,你只能调试主机代码 之后的第一个CUDA内核。如果您希望在第一个CUDA内核之前调试主机代码,该怎么办?

STILL UNANSWERED: Is it possible to start debugging the host code before hitting a CUDA breakpoint? It seems like a big limitation that you can only debug host code following your first CUDA kernel. What if you wish to debug the host code before the first CUDA kernel?

这篇关于Nvidia视觉工作室Nsight CPU和GPU调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 00:35