Creating timer in CUDA 4.0

I am trying to use cutCreateTimer(…) in CUDA 4.0

Witch librairy I should include to use timer in CUDA 4.0

in CUDA 3.2 I include shrUtils library, withc I think is no longer available on CUDA 4.0



You can find shared utils in $(CUDA_SDK_ROOT)/shared/. You need to compile it (for Linux).

Best regards,

Assuming that you’re looking for a GPU-based timer, use events, i.e.

cudaEvent_t start, stop; 

float time; 



cudaEventRecord( start, 0 ); 

kernel<<<grid,threads>>> ( d_odata, d_idata, size_x, size_y, NUM_REPS); 

cudaEventRecord( stop, 0 ); 

cudaEventSynchronize( stop ); 

cudaEventElapsedTime( &time, start, stop ); 

cudaEventDestroy( start ); 

cudaEventDestroy( stop );

If you need clarification, I’d advise reading the CUDA Best Practices guide. The above code is from there, and section 2.1 of the guide is exclusively devoted to timing.

Thank’s guy…
I should read that “Best Practices Guides” from the beginning to the end…not just a few section like I did…

@alrikai very well answer, but you forgot to write, that time is expressed in miliseconds.