From be783996a88a4ba073f429ccc29e8cc5f1f7b3b9 Mon Sep 17 00:00:00 2001 From: Matia Pizzoli Date: Fri, 13 Nov 2015 19:33:50 +0100 Subject: [PATCH] added timing to CUDA findEqual test (time includes download of result) --- test/reduction_test.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/reduction_test.cpp b/test/reduction_test.cpp index c938170..8cf4a4a 100644 --- a/test/reduction_test.cpp +++ b/test/reduction_test.cpp @@ -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(cv_sum.val[0]) << ", CUDA sum=" << cu_sum << std::endl; ASSERT_FLOAT_EQ(cv_sum.val[0], cu_sum); @@ -104,7 +104,14 @@ TEST(deviceImageReduction, countEqual) num_blocks_per_grid.y = 4; rmd::ImageReducer 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);