cuda-gdb crashes with thrust (CUDA release 5.5)

China☆狼群 提交于 2019-11-28 13:11:14

As talonmies indicated, the problem is the Thrust libraries do not run correctly when built with debugging. In my application I have a rather complicated .cu file containing several of my own CUDA kernels, along with multiple Thrust calls. If I were to compile this file with the -g -G debug flags and run inside cuda-gdb, it would crash -- making it impossible for me to debug my kernels.

Since I do not care about debugging the Thrust calls themselves (only my kernels), my solution involved putting all my thrust calls in another file thrustWrappers.cu and compiling this file without debugging. Then in my main .cu file I would replace the calls to thrust with associated wrapper functions (defined in thrustWrappers). For example,

thrust::reduce(...)

became

thrust::reduce_wrapper(...)

Then I would link the two resulting object files together.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!