Lets say I have the following:
void init_gpu(cuComplex* d_hhBuff)
{
cutilSafeCall(cudaMalloc((void **)&d_hhBuff, memsize));
}
and I call it with something like
cuComplex *my_buff;
init_gpu(my_buff);
Well, when init_gpu returns, it is NOT pointing to the device memory that cudaMalloc allocated.
How do I modify this so that the caller of init_gpu will have my_buff pointing to the modified d_hhBuff that cudaMalloc creates?
The problem is that you are passing the pointer by value. Change the function header to