When I used CUDA memory, sometimes I need to pass the CUDA memory pointer to another function or class. Can I use a cpu pointer to catch the memory location? In the while, I would not free the GPU memory until the other function had done its work.
For an easy example:
cudaMallocManaged(&GPUp, sizeof(int) * 1000);
int* CPUp = GPUp;
It seems that the program works correctly. But I am not sure it is the correct way to pass the GPU pointer as a parameter and not sure it will always work.