I would like to understand what exactly happens when a cudaMalloc function is called.
float *d_A; cudaMalloc(d_A, 10 * sizeof(float));
Looking from host perspective, at line 1, d_A is just a floating pointer containing NULL value. At line 2, a memory is allocated on device memory as cudaMalloc is called.
What happens inside line 2 i.e. what happens between calling cudaMalloc function and allocating memory on device memory. Where is cudaMalloc executed(Host or device)? How is memory management on device memory taken care of?
After line 2, how does the host treat the d_A pointer as? Is it just another pointer for host or will it treat d_A as some special pointer?