如何使用 Visual Studio 2008 调试 CUDA 内核代码?

发布于 2024-09-29 02:38:42 字数 264 浏览 4 评论 0原文

嘿, 我正在使用带有 CUDA 3.2 的 Visual Studio 2008。我正在尝试调试具有此签名的函数:

 MatrixMultiplication_Kernel<<<dimGrid, dimBlock>>>(Md, Nd, Pd, Width);

我可以单步执行该函数,但是当我进入该函数时,它不允许我单步执行任何代码并告诉我没有可用的源代码。有人知道如何正确调试这个吗?

谢谢你!

Hey,
I am using Visual Studio 2008, with CUDA 3.2. I am trying to debug into a function with this signature:

 MatrixMultiplication_Kernel<<<dimGrid, dimBlock>>>(Md, Nd, Pd, Width);

I can step into the function, however when I get into the function it doesn't let me step over any of the code and tells me that no source is available. Anybody knows how to debug into this properly?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

花伊自在美 2024-10-06 02:38:42

现在,您可以使用 NSight 在只有一个 GPU 的单台计算机上进行调试。

我想我会更新这个,因为之前的答案不再正确(你不再需要 2 个 GPU),它让我有一段时间走错了方向。

You can now debug on a single machine with only one GPU using NSight.

Thought I'd update this, since the previous answers are no longer correct (you no longer need 2 GPUs) and it sent me off in the wrong direction for a while.

贪恋 2024-10-06 02:38:42

更新:Parallel Nsight 现已免费,并且支持仅使用系统中的一个 GPU 进行调试。

要在 Visual Studio 中调试设备代码,您需要 < a href="http://www.nvidia.com/object/parallel-nsight.html" rel="noreferrer">并行 Nsight。标准版本是免费,并提供您所需的调试以及设备代码分析。

如果您想在一台机器上进行调试,那么您将需要两个 GPU(因为运行代码的 GPU 在遇到断点时将停止,因此您的显示也会阻塞)。不过,它们不需要是高端 GPU,从 G92 开始的任何 GPU 都可以(包括列出的大多数 Fermi GPU 此处)。

Update: Parallel Nsight is now free and supports debugging with only one GPU in your system.

To debug device code within Visual Studio you will need Parallel Nsight. The standard version is free and offers the debugging you require as well as device code profiling.

If you want to debug on a single machine then you will need two GPUs (since the GPU running the code will be stopped when it hits a breakpoint, and hence your display would block as well). They don't need to be high-end GPUs though, anything from G92 onwards will do (including most Fermi GPUs as listed here).

新人笑 2024-10-06 02:38:42

您是否使用Nsight? Vanilla Visual Studio 无法进入设备代码,但使用 Nsight,这是可能的。不幸的是,Windows 设备驱动程序模型的局限性意味着存在一些严重的限制。以前需要两台机器来调试。目标机器将在其 GPU 上运行 CUDA 代码,并且必须使用 TCC 驱动程序。主机将运行 Visual Studio 并控制目标。看来现在只要有两个 GPU,一个用于计算,一个用于显示,就可以在同一台机器上调试 CUDA 代码。 用户中提到了许多其他问题指南

这可能不是一个可接受的答案,但是:如果您可以在 Linux 上编译代码,则可以使用 cuda-gdb 来调试内核。 cuda-gdb 是 Linux CUDA 工具包的一部分。

Are you using Nsight? Vanilla Visual Studio cannot step into device code, but with Nsight, this is possible. Unfortunately, limitations of the Windows device driver model mean there are some serious restrictions. It used to be that two machines were required to do the debugging. The target machine would run the CUDA code on it's GPU, and had to be using the TCC driver. The host machine would run Visual Studio and control the target. It seems that it is now possible to debug CUDA code on the same machine as long as you have two GPU's, one for compute and one for display. There are a number of other problems mentioned in the user guide.

This may not be an acceptable answer, but: If you can compile your code on Linux, you can use cuda-gdb to debug kernels. cuda-gdb is part of the Linux CUDA toolkit.

要走干脆点 2024-10-06 02:38:42

您无法使用 Visual Studio 调试 CUDA 内核代码。 Visual Studio只能调试在CPU上运行的程序。

事实上,我认为你根本无法再在 Windows 中调试 CUDA 内核代码。 CUDA曾经有一个主机模拟模式,但在3.0中被删除。唯一可用的调试工具是 cuda-gdb 和 ocelot,据我所知,它们都不支持 Windows。

You can't debug CUDA kernel code using visual studio. Visual studio can only debug programs that run on the CPU.

In fact, I don't think that you can debug CUDA kernel code in Windows at all any more. CUDA used to have a host emulation mode, but that was removed in 3.0. The only debugging tools available are cuda-gdb and ocelot, and, as far as I know, neither of them supports Windows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文