本文介绍了CUDA调试:“目标位置没有值”,我清楚地设置了一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个非常令人沮丧的错误,我的代码中的变量没有值。
这是我的代码的图片,底部有调试器信息。

I am getting a very frustrating error where a variable in my code does "not have a value".Here is a picture of my code with the debugger information at the bottom.

我的原代码只有红色方块,但我添加在蓝色方块Xmax = 40只是为了看我是否可以强制一个值到变量。显然你可以看到还有一个问题。任何洞察我为什么得到这个错误?

My original code only has the red squares, but I added in the blue square "Xmax = 40" just to see if i could force a value into the variable. Obviously you can see there is still a problem. Any insight into why I am getting this error?

推荐答案

你遇到的问题很可能是由于变量的生存区间。大多数编译器在编译调试代码时会将变量的生效范围扩展为等于变量的范围。

The problem that you are experiencing is very likely due to the live range of the variable. Most compilers when compiling code for debugging extend the live range of variables to be equal to the scope of the variables.

NVCC编译器不会扩展变量的生效范围。此外,即使未指定优化标志,NVCC编译器也会执行一些优化。这可以导致消除用户指定的变量。扩展变量的活动范围是CUDA调试器功能请求列表中的最重要的项目之一,但我不能告诉你在什么版本中这个问题将被解决。

The NVCC compiler does not extend the live range of the variables. Furthermore, NVCC compiler performs some optimizations even when optimizations flags are not specified. This can lead to elimination of user specified variables. Extending the live range of the variables is one of the top items on the CUDA debugger feature request list but I cannot tell you in what release this issue will be resolved.

I建议您通过CUDA注册开发人员计划有关该问题的错误。

I recommend that you submit a bug on the issue through the CUDA Registered Developer Program.

这篇关于CUDA调试:“目标位置没有值”,我清楚地设置了一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 05:49