5cc0976c
David Mayerich
added separable c...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef STIM_CUDA_TIMER
#define STIM_CUDA_TIMER
static cudaEvent_t tStartEvent;
static cudaEvent_t tStopEvent;
namespace stim{
/// These functions calculate the time between GPU functions in milliseconds
static void gpuStartTimer()
{
//set up timing events
cudaEventCreate(&tStartEvent);
cudaEventCreate(&tStopEvent);
cudaEventRecord(tStartEvent, 0);
}
static float gpuStopTimer()
{
cudaEventRecord(tStopEvent, 0);
cudaEventSynchronize(tStopEvent);
float elapsedTime;
cudaEventElapsedTime(&elapsedTime, tStartEvent, tStopEvent);
cudaEventDestroy(tStartEvent);
cudaEventDestroy(tStopEvent);
return elapsedTime;
}
} //end namespace stim
|