From: Anatoly Baksheev Date: Fri, 8 Jul 2011 16:08:58 +0000 (+0000) Subject: - fixed SetTo tests for GPU (a problem in test code) X-Git-Tag: accepted/2.0/20130307.220821~2483 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1dd41d1e2126f6df5eae34544b4adf121373751;p=profile%2Fivi%2Fopencv.git - fixed SetTo tests for GPU (a problem in test code) - minor refactoring --- diff --git a/modules/gpu/test/test_main.cpp b/modules/gpu/test/test_main.cpp index fcf9b78..57a26af 100644 --- a/modules/gpu/test/test_main.cpp +++ b/modules/gpu/test/test_main.cpp @@ -46,50 +46,49 @@ void print_info() { + printf("\n"); #if defined _WIN32 # if defined _WIN64 - puts("OS: Windows 64\n"); + puts("OS: Windows 64"); # else - puts("OS: Windows 32\n"); + puts("OS: Windows 32"); # endif #elif defined linux # if defined _LP64 - puts("OS: Linux 64\n"); + puts("OS: Linux 64"); # else - puts("OS: Linux 32\n"); + puts("OS: Linux 32"); # endif #elif defined __APPLE__ # if defined _LP64 - puts("OS: Apple 64\n"); + puts("OS: Apple 64"); # else - puts("OS: Apple 32\n"); + puts("OS: Apple 32"); # endif #endif - printf("CUDA version: %d\n\n", CUDART_VERSION); - int deviceCount = cv::gpu::getCudaEnabledDeviceCount(); - - printf("Found %d CUDA devices\n\n", deviceCount); + printf("CUDA version: %d\n", CUDART_VERSION); + printf("CUDA device count: %d\n\n", deviceCount); for (int i = 0; i < deviceCount; ++i) { cv::gpu::DeviceInfo info(i); printf("Device %d:\n", i); - printf("\tName: %s\n", info.name().c_str()); - printf("\tCompute capability version: %d.%d\n", info.majorVersion(), info.minorVersion()); - printf("\tTotal memory: %d Mb\n", static_cast(static_cast(info.totalMemory() / 1024.0) / 1024.0)); - printf("\tFree memory: %d Mb\n", static_cast(static_cast(info.freeMemory() / 1024.0) / 1024.0)); + printf(" Name: %s\n", info.name().c_str()); + printf(" Compute capability version: %d.%d\n", info.majorVersion(), info.minorVersion()); + printf(" Total memory: %d Mb\n", static_cast(static_cast(info.totalMemory() / 1024.0) / 1024.0)); + printf(" Free memory: %d Mb\n", static_cast(static_cast(info.freeMemory() / 1024.0) / 1024.0)); if (info.isCompatible()) - puts("\tThis device is compatible with current GPU module build\n"); + puts(" This device is compatible with current GPU module build\n"); else - puts("\tThis device is NOT compatible with current GPU module build\n"); + puts(" This device is NOT compatible with current GPU module build\n"); } - puts("GPU module was compiled for next GPU archs:"); - printf("\tBIN:%s\n", CUDA_ARCH_BIN); - printf("\tPTX:%s\n\n", CUDA_ARCH_PTX); + puts("GPU module was compiled for the following GPU archs:"); + printf(" BIN: %s\n", CUDA_ARCH_BIN); + printf(" PTX: %s\n\n", CUDA_ARCH_PTX); } enum OutputLevel diff --git a/modules/gpu/test/test_matop.cpp b/modules/gpu/test/test_matop.cpp index 8b16a9a..800fc88 100644 --- a/modules/gpu/test/test_matop.cpp +++ b/modules/gpu/test/test_matop.cpp @@ -337,9 +337,11 @@ TEST_P(SetTo, Masked) static cv::Scalar s = cv::Scalar(1, 2, 3, 4); - cv::Mat mat; + cv::RNG& rng = cvtest::TS::ptr()->get_rng(); - cv::Mat mask = cvtest::randomMat(rng, mat.size(), CV_8UC1, 0.0, 1.5, false); + cv::Mat mask = cvtest::randomMat(rng, mat_gold.size(), CV_8UC1, 0.0, 1.5, false); + + cv::Mat mat; ASSERT_NO_THROW( cv::gpu::GpuMat dev_mat(mat_gold);