Which header file to be included for following code snippet to measure time using cuda event mathods?
cudaEvent_t start,stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
float Elapsed=0,Cycle;
for (int p=1; p<=MSG_NUM; p++)
{
cudaEventRecord(start,0);
add<<<R, (M+R), (M+R)* sizeof(int)>>>( d_msg, d_checkSumArray );
cudaEventRecord(stop,0);
cudaEventSynchronize(stop);
cudaElapsedTime(&Cycle,start,stop);
Elapsed += Cycle;
}
printf("Time = %f",Elapsed);
My program show following error as no header file included.
error : identifier “cudaElapsedTime” is undefined
Can someone give the solution please?
The correct API call is cudaEventElapsedTime(…).
Other than that your parameters look correct.
You don’t need any special include headers if you are compiling with nvcc.