Class faiss::gpu::KernelTimer

class KernelTimer

Utility class for timing execution of a kernel.

Public Functions

KernelTimer(cudaStream_t stream = 0)

Constructor starts the timer and adds an event into the current device stream


Destructor releases event resources.

float elapsedMilliseconds()

Adds a stop event then synchronizes on the stop event to get the actual GPU-side kernel timings for any kernels launched in the current stream. Returns the number of milliseconds elapsed. Can only be called once.

Private Members

cudaEvent_t startEvent_
cudaEvent_t stopEvent_
cudaStream_t stream_
bool valid_