Hi,
I’m somewhat new to CUDA and I have seen the following version of calling cudaMalloc function:
cudaMalloc(&d_ptr,sizeof(float)*N)
cudaMalloc((void **) &d_ptr, sizeof(float)*N)
I have also seen that the documentation of the runtime API says that the parameter is a double pointer. What’s the difference between both versions?
Thanks for your time.
expects a void pointer to pointer. The first realization is not technically a void pointer to pointer, but is castable to that. nvcc generally does not object to that implicit cast. The second version will work with any compiler that objects to the implicit cast in the first version.