What kind of resource can I use to measure time in Windows?
I’m trying to measure execution time between my CUDA algorithm and my Sequencial C algorithm.
The precision must be better then seconds. Milliseconds is fine.
I tried to use the GetSystemTime from an example on the internet but the precision was seconds.
Use the CUDA event API:
http://developer.download.nvidia.com/compu…854e6020a5.html
vibi
3
void startTimer(unsigned int timer, cudaEvent_t start)
{
cutilCheckError( cutStartTimer( timer)); // CPU timer
cutilSafeCall( cudaEventRecord( start, 0 ) ); //GPU timer
}
void stopTimer_DisplayElapsedTime(unsigned int timer, cudaEvent_t start, cudaEvent_t stop, float elapsedTimeInMs_GPU, float elapsedTimeInMs_CPU)
{
cutilCheckError( cutStopTimer( timer)); //CPU timer
cutilSafeCall( cudaEventRecord( stop, 0 ) ); // GPU timer
cutilSafeCall( cudaThreadSynchronize() );
cutilSafeCall( cudaEventElapsedTime( &elapsedTimeInMs_GPU, start, stop ) );
elapsedTimeInMs_CPU = cutGetTimerValue( timer);
printf("elapsed time in ms : GPU counter = %lf , CPU counter = %lf \n", elapsedTimeInMs_GPU, elapsedTimeInMs_CPU);
}
Great! I’ll try that today! Thanks alot!