2

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.

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?

enter image description here

4

1 回答 1

4

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

NVCC 编译器不会扩展变量的有效范围。此外,即使未指定优化标志,NVCC 编译器也会执行一些优化。这会导致消除用户指定的变量。扩展变量的有效范围是 CUDA 调试器功能请求列表中的首要项目之一,但我无法告诉您此问题将在哪个版本中得到解决。

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

于 2012-12-16T02:34:55.973 回答