im trying to rework one of the SDK examples to give me the elapsed time using cudaEvent functions
cudaEvent_t start, stop; cudaEventCreate(&start); cudaEventCreate(&stop); cudaEventRecord(start,0); /*.......*/ /* CODE HERE */ /*.......*/ cudaEventRecord(stop,0); cudaEventSynchronize(stop); float elapsedTime; cudaEventElapsedTime(&elapsedTime, start, stop); printf("Elapsed time: %f\n",elapsedTime);
But the result is that it always prints
Elapsed time: 0.000000
and yes, the code is executed over a period of time, so no elapsed time should be possible.
Can anyone think as to why it is doing this? how can i get elapsed time to work?