Hi all,
I seem to have stumbled across a strange error with cudaMemcpyToSymbol. The problem is that I cannot copy data into an array on the device. Here is a test program that demonstrates what the problem is.
[codebox]#include <stdio.h>
constant float constData[2];
int main()
{
float data[2] = {1, 2};
cudaMemcpyToSymbol(constData, data, sizeof(data));
printf(“%f\n”, data[0]);
printf("%f\n", constData[0]);
return 0;
}[/codebox]
When I run this program in emulation mode, it appears that the floats are not copied into constData. The output that I get is:
1.0
0.0
What am I doing wrong? Is it because I’m running this in emulation mode? Or did I make some other mistake?
Thank a lot!