I have successfully run many CUDA programs. In almost every program I have used cudamalloc(); function. But I am unable to understand exactly why a pointer to a pointer variable i.e.void** devPtr is used in the function argument.
The definition of the function from the reference guide is as below:
cudaMalloc - allocate memory on the GPU
cudaError_t cudaMalloc( void** devPtr, size_t count )
Allocates count bytes of linear memory on the device and returns in *devPtr a pointer to the allocatedmemory. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared.cudaMalloc() returns cudaErrorMemoryAllocation in case of failure.
For any pointers to this pointer question will be highly appreciated. :-)