Unable to read global memory inside a kernel allocation


I am having trouble to access on global device pointer inside a kernel. Even though i managed to allocate memory on it (cudaMalloc and cudaMallocToSymbol), the pointer is still considered as not allocated when debugging in the kernel.

Do you know if i miss something?



Never mind ! I solved it now. So, I just did what Nvidia suggests:

__device__ float* devPointer;
float* ptr;
cudaMalloc(&ptr, 256 * sizeof(float));
cudaMemcpyToSymbol(devPointer, &ptr, sizeof(ptr));

However, instead of doing sizeof(ptr) on the cudaMemcpyToSymbol, I was putting the size explicitly (256 * sizeof(float)) and that’s why it did not work.