Hi,
I am currently testing Cuda 5 and encountered this issue when compiling a code like the one below
file1.cu
namespace file1 {
__device__ __constant__ float f;
}
// Kernels and kernel calling functions
main.cc
main()
{
....
cudaMemcpyToSymbol("file1:f", &var, sizeof(float));
....
}
Until Cuda 5 this code compiled and worked perfectly. On Cuda 5 the code compiles but i got a “Invalid device symbol” at the cudaMemcpyToSymbol call.
Obviously with the new linking feature of nvcc 5 i have a workaround:
main.cc
namespace file1 {
extern __device__ __constant__ float f;
}
main()
{
....
cudaMemcpyToSymbol((const char *) &file1:f, &var, sizeof(float));
....
}
but obviously this new version did not compile with Cuda < 5.
My code is quite big so i want to avoid creating a Cuda < 5 and a Cuda 5 branch only for that. So my questions are:
this problem is a bug in Cuda 5 ? a momentary missing feature ? there is a simpler workaround for all version of Cuda ?