Skip to content

Commit

Permalink
added timing to CUDA findEqual test (time includes download of result)
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzoli committed Nov 13, 2015
1 parent 679412f commit be78399
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/reduction_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ TEST(deviceImageReduction, sum)
float cu_sum = img_reducer.sum(d_img);
sdkStopTimer(&timer);
t = sdkGetAverageTimerValue(&timer) / 1000.0;
printf("CUDA execution time: %f seconds.\n", t);
printf("CUDA execution time (including download of result): %f seconds.\n", t);

std::cout << "DEBUG: OpenCV sum=" << static_cast<float>(cv_sum.val[0]) << ", CUDA sum=" << cu_sum << std::endl;
ASSERT_FLOAT_EQ(cv_sum.val[0], cu_sum);
Expand Down Expand Up @@ -104,7 +104,14 @@ TEST(deviceImageReduction, countEqual)
num_blocks_per_grid.y = 4;
rmd::ImageReducer<int> img_reducer(num_threads_per_block, num_blocks_per_grid);

StopWatchInterface * timer = NULL;
sdkCreateTimer(&timer);
sdkResetTimer(&timer);
sdkStartTimer(&timer);
size_t cu_count = img_reducer.countEqual(d_img, TO_FIND);
sdkStopTimer(&timer);
t = sdkGetAverageTimerValue(&timer) / 1000.0;
printf("CUDA execution time (including download of result): %f seconds.\n", t);

std::cout << "DEBUG: OpenCV count=" << cv_count << ", CUDA count=" << cu_count << std::endl;
ASSERT_EQ(cv_count, cu_count);
Expand Down

0 comments on commit be78399

Please sign in to comment.