问题描述
我使用visual studio 2010,parallel nsight 2.2和cuda 4.2进行学习。我的系统是Windows 8 pro x64。
我打开了radix排序项目,包括在VS中的cuda计算SDK,并编译它没有错误。排序代码使用推力库:
if(keysOnly)
thrust :: sort(d_keys.begin d_keys.end());
else
thrust :: sort_by_key(d_keys.begin(),d_keys.end(),d_values.begin());
我想知道如何强制派遣排序函数到cuda内核,所以我试图添加断点前面的行并在调试模式下编译项目。但是当我使用parallel nsight进行cuda调试时,总是会出现没有源断点对应的错误。
所以,我的问题是:
- 如何使用parallel nsight在visual studio中调试cuda推力程序?
- 或者有人可以指示我使用另一种方式要知道cuda如何向cuda内核或其他函数推送dipatch函数?
任何建议都将不胜感激!
$ b $通常,要调试CUDA中的设备代码,必须传递: > -G -g
切换到nvcc。但是,此模式是。你可以通过遵循推力包含文件中的结构来了解推力代码如何被分派到设备。因为推力是完全模板化的代码,没有图书馆要担心。然而这是一个具有挑战性的提议。你也可以告诉编译器生成ptx:
-ptx
这是。然而,这不是一个微不足道的东西解析。 提供了有关使用Thrust调试的一些备用方法。
I am using visual studio 2010, parallel nsight 2.2 and cuda 4.2 for learning. My system is Windows 8 pro x64.I opened the radix sort project which included by cuda computing SDK in VS, and compiled it with no error. The sort code uses thrust library:
if(keysOnly)
thrust::sort(d_keys.begin(), d_keys.end());
else
thrust::sort_by_key(d_keys.begin(), d_keys.end(), d_values.begin());
I want to know how thrust dispatch the sort function to cuda kernels, so I tried to add breakpoints in front of lines above and compiled the project in debug mode. But when I use parallel nsight for cuda debugging, there are always errors that "no source correspondence for breakpoint".
So, my problems are:
- How to debug cuda thrust programs in visual studio with parallel nsight?
- Or is there anyone can instruct me using another way to know how cuda thrust dipatch functions to cuda kernels or other functions?
Any advise will be appreciated!
Normally, to debug device code in CUDA, it's necessary to pass the:
-G -g
switches to nvcc. However this modality is not supported with thrust code. You can get an idea of how thrust code gets dispatched to the device by following the structure in the thrust include files. Since thrust is entirely templatized code, there are no libraries to worry about. However that's a challenging proposition. You can also tell the compiler to generate ptx:
-ptx
which is one of the intermediate code types that cuda code gets compiled to. However that is not a trivial thing to parse either. This link gives some alternate ideas for debugging with Thrust.
这篇关于如何调试cuda推力功能在visual studio 2010与并行nsight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!