方法1:
cudaEvent_t start1;
cudaEventCreate(&start1);
cudaEvent_t stop1;
cudaEventCreate(&stop1);
cudaEventRecord(start1, NULL);
需要测时间的内核函数kernel;
cudaEventRecord(stop1, NULL);
cudaEventSynchronize(stop1);
float msecTotal1 = 0.0f;
cudaEventElapsedTime(&msecTotal1, start1, stop1);
方法2:
StopWatchInterface * timer_cublas;
sdkCreateTimer(&timer_cublas);
sdkStartTimer(&timer_cublas);
需要测时间的内核函数kernel;
sdkStopTimer(&timer_cublas);
cudaThreadSynchronize();
double dSeconds = sdkGetTimerValue(&timer_cublas)/((double)nIter);
阅读(5294) | 评论(0) | 转发(0) |