How to time CUDA Event


#1

Hi,

In CUDA C, you can time how long GPU ran by using event, this will record the time for just GPU running time, which does not include data transfer. Is there a similar functionality in CuArray or other GPU packages?


#2

CUDAdrv wraps the event API. You can use CUDAdrv.@elapsed to automatically enqueue events before and after code and return the elapsed time between both. Or manually construct CuEvents and call record/synchronize/elapsed on them.


#3

Thank you! Is there any difference in reporting between the two methods?


#4

No, one is built on top of the other: https://github.com/JuliaGPU/CUDAdrv.jl/blob/2a77dff0eaad0df12abd8cf05e73b3f9d5968ad5/src/events.jl#L73-L87