I have defined a constant variable at file scope:
device constant float d_C_sqrt_2pi;
and I attempt to write its value into device memory from the host code:
float C_sqrt_2pi_ = …;
err = cudaMemcpyToSymbol(&d_C_sqrt_2pi, &C_sqrt_2pi_, sizeof(float), 0, cudaMemcpyHostToDevice);
if (err != cudaSuccess)
{
// print message
}
This consistently returns the error “invalid device symbol”. I tried the relevant solutions in the following post (where it was suggested but not confirmed that this is a Cuda bug):
[url=“http://forums.nvidia.com/index.php?showtopic=154504”]The Official NVIDIA Forums | NVIDIA
but none of the suggestions helped. Do I need to cudaMalloc() the constant? Any idea what I’m doing wrong?
I am using a GeForce 480 card on
x86_64 Red Hat Enterprise Linux Client release 5.4 (Tikanga)
Nvidia driver version 256.40
The Cuda toolkit I downloaded was cudatoolkit_3.1_linux_64_rhel5.4.run