Answer the question
In order to leave comments, you need to log in
Time difference?
Hello, can you please tell me what is the difference between:
clock_t start1 = clock();
...
clock_t end1 = clock();
double seconds1 = (double)(end1 - start1) / CLOCKS_PER_SEC;
cout << "Time: " << seconds1 << " sec" << endl;
cudaEvent_t start, stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord(start, 0);
...
cudaThreadSynchronize();
cudaEventRecord(stop, 0);
cudaEventSynchronize(stop);
float elapsedtime;
cudaEventElapsedTime(&elapsedtime, start, stop);
printf("Time = %3.1f ms\n", elapsedtime);
cudaEventDestroy(start);
cudaEventDestroy(stop);
Answer the question
In order to leave comments, you need to log in
The fundamental difference is that the cuda interface is asynchronous, i.e. the time between start/stop will change the rate at which code is sent to the GPU.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question