I have a problem related to CUDA. I create a array which is 2D with :
char **WordMatrix = new char*[N]; // M and N set by the user
for(int i = 0; i < N; ++i)
{
WordMatrix[i] = new char[M];
}
I fill the array with a loop. After that where my problem is lying : I can't managed to allocate the memory in device and copy from host to device.
I saw other questions related to this but I did not understand the logic. Like in this topic : https://devtalk.nvidia.com/default/topic/410182/double-pointer-allocation/ or in here.
I want to understand how to do it with an code example which uses cudaMemcpy and cudaMalloc and 2D Array also explanation of why we need supporting(if you use the approach in the link) pointer?