File size: 453 Bytes
98a67a0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#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;
}
};
|