Is it possible to allocate constant memory without knowing the size at compile time?
By now, I have done the following:
__constant__ float temp[100];
...
cutilSafeCal(cudaMemcpyToSymbol("temp", &h_temp, 100 * sizeof(float), 0, cudaMemcpyHostToDevice));
...
But now I don’t know the size of the array at compile time.
What I tried (without success):
__constant__ float *temp;
...
cutilSafeCall(cudaMalloc((void **)&temp, 100 * sizeof(float)));
cutilSafeCall(cudaMemcpy(temp, h_temp, 100 * sizeof(float), cudaMemcpyHostToDevice));
...
If I access the array (temp[0]) inside the kernel, I get wrong values.