I am having a hard time on using constant memory space.
(1) According to Programming Guide (2.3) B.2.5, constant variables are only allowed at file scope, and they can not be defined by the extern keyword. So the question is: is it possible to make some constant data visible across multiple files?
(2) According to Programming Guide (2.3) B.2.5, the function cudaGetSymbolAddress can be used to take the address of a constant variable. However, the following code complains “cannot take the address of constant data”. What is wrong with it? Or simply we could not take the address of a constant variable, not as stated in the programming guide.
using namespace std;
constant int DATA;
int d = 1;
cudaMemcpyToSymbol(“DATA”, &d, sizeof(int));
cudaError_t err = cudaGetSymbolAddress((void*)&data_ptr, “DATA”);
cout << cudaGetErrorString(err) << endl;
Thanks in advance!