I would like to report the following strange behavior on CUDA. The following is a simple code that runs on Linux (openSUSE 11.1), but not run on Windows Vista x64:
const float A = 10.0;
host device float sqrtA()
return A * A;
std::cout << sqrtA() << std::endl;
When I try to run on Visual Studio, I get the error: identifier “A” is undefined
Then I tried to specify device on variable A:
[codebox]device const float A = 10.0;[/codebox]
It do not give me a compilation error anymore (because nvcc was able to compile function sqrtA() on the device), BUT the value printed is ZERO, which means that the host function compiled by nvcc is not accessing the correct value of variable A.
Please, help me. I have already posted a similar thread and nobody answered.