emelryan's picture
Duplicate from nvidia/nemotron-ocr-v2-multilingual
b28505d
Raw
History Blame Contribute Delete
453 Bytes
#pragma once
struct cuda_timer {
cudaEvent_t start_event;
cudaEvent_t stop_event;
void start() {
cudaEventCreate(&start_event);
cudaEventCreate(&stop_event);
cudaEventRecord(start_event, 0);
}
float stop() {
cudaEventRecord(stop_event, 0);
cudaEventSynchronize(stop_event);
float time = 0;
cudaEventElapsedTime(&time, start_event, stop_event);
return time;
}
};