在Visual Studio中调试cuda文件 [英] debugging cuda files in visual studio

查看:1088
本文介绍了在Visual Studio中调试cuda文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个cpp函数(function.cpp),我mex,然后我打开visual studio中的function.cpp文件,并附加visual studio到运行matlab过程。



当我调用matlab中的函数时,我能够在function.cpp文件中设置断点,并逐步通过观察变量。



当我把函数改变为cuda文件(function.cu)时,调试过程中断。按照上述过程,我仍然能够在function.cu中停止,但是我看不到任何变量,当我试图看一个变量它说错误符号..未找到



我在Visual studio中安装了nsight问题:如何在文件function.cu中观察我的变量这是可能的吗?



请注意,function.cu不是在项目中,它只是一个独立的文件cpp代码的函数(说somefunction(){})。为了调试的目的,我打开它在visual studio。我在matlab中使用nvmex -g wrapper.cu编译function.cu文件wrapper.cu是一个matlab mexfunction wrapper,它调用somefunction()写在function.cu

Parallel Nsight Visual Studio Edition 。



您可以在文档中搜索附加到正在运行的进程的指南,对于当前版本(2.2),特定页面此处


i have a cpp function (function.cpp") which i "mex"-ed. then i open the function.cpp file in visual studio and attach visual studio to a running matlab process.

when i call the function in matlab i am able to set breakpoints in the function.cpp file and step through it observing the variables.

The debugging process breaks down when i change the function to a cuda file (function.cu). Following the process described above i am still able to stop within function.cu but i cannot see any variables. when i try to "watch" a variable it says "Error symbol .. not found"

i have nsight installed in visual studio. question: how can i observe my variables in the file function.cu in the debug mode as i do for the function.cpp file. Is this possible ?

Note that the function.cu is not in a project. it is just a standalone file with cpp code of a function (say somefunction(){}). for debugging purpose i am opening it up in visual studio. i am compiling the function.cu file in matlab using "nvmex -g wrapper.cu" the wrapper.cu is a matlab mexfunction wrapper which makes calls to somefunction() written inside function.cu

解决方案

You're using the VS debugger which is a host debugger, so it doesn't know how to debug device programs. To debug device code in Windows you should look at Parallel Nsight Visual Studio Edition.

You can search the docs for a guide to attaching to a running process, for the current release (2.2) the specific page is here.

这篇关于在Visual Studio中调试cuda文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆