Reputation: 5
In CUDA, does passing a unified memory pointer to a kernel slows down the program?
I got a kernel doing something,and then I cudaMallocManage some unified memory outside the kernel, then pass the pointer to the kernel as parameters. And I used cuda_Event to time. The kernels runs much slower from 1900ms to 3000ms.
Why passing a pointer takes too much ? A pointer?
How should I speed up the program?
Upvotes: 0
Views: 173
Reputation: 72349
Passing a managed pointer to a kernel in itself has no effect on performance. But reading and writing to or from the managed memory which the pointer addresses may trigger a lot of ad-hoc memory transfer over the PCI-e bus. And that could be very slow.
Upvotes: 1