Hello,
I am trying to measure the elapsed time of my kernel with CUDA events. Although whole program finishes its execution in about 2 sec, cuda elapsed time shows 6.88128e+006. As far as i know, cudaEventElapsedTime returns in millisecond. But this value shows something like 6.881.280 milliseconds which is about 6881 seconds. I do not understand what is happening. I am attaching related code snap as well. Any idea?
Many thanks for your time
cudaEventCreate (&start);
cudaEventCreate (&stop);
float total_time = 0.0;
while(genNumber < MAX_GENERATION && h_best > DESIRED_FITNESS){
cudaEventRecord (start,0);
evolvePopulation<<<MAX_POPULATION / BLOCK_SIZE, BLOCK_SIZE, trainDataSize * sizeof(ANNDATA) + BLOCK_SIZE * sizeof(float)>>>(d_individuals,d_training_data,trainDataSize,d_random,d_f
itnessArry, d_result,d_best);
cudaEventRecord (stop,0);
cudaEventSynchronize (stop);
cudaEventElapsedTime (&elapsedTime, start, stop);
cudaMemcpy (&h_best,d_best,sizeof(float), cudaMemcpyDeviceToHost);
cudaThreadSynchronize ();
total_time +=elapsedTime;
perform<<" Generation : "<<genNumber<<" elapsed time : "<<elapsedTime<<" Total time : "<<total_time<<endl;
cout<<"Generation : "<<genNumber<<" Min Fitness: "<<h_best<<endl;
++genNumber;
}