Commit e1dd41d1 authored by Anatoly Baksheev's avatar Anatoly Baksheev

- fixed SetTo tests for GPU (a problem in test code)

- minor refactoring
parent 0b1575c4
...@@ -46,50 +46,49 @@ ...@@ -46,50 +46,49 @@
void print_info() void print_info()
{ {
printf("\n");
#if defined _WIN32 #if defined _WIN32
# if defined _WIN64 # if defined _WIN64
puts("OS: Windows 64\n"); puts("OS: Windows 64");
# else # else
puts("OS: Windows 32\n"); puts("OS: Windows 32");
# endif # endif
#elif defined linux #elif defined linux
# if defined _LP64 # if defined _LP64
puts("OS: Linux 64\n"); puts("OS: Linux 64");
# else # else
puts("OS: Linux 32\n"); puts("OS: Linux 32");
# endif # endif
#elif defined __APPLE__ #elif defined __APPLE__
# if defined _LP64 # if defined _LP64
puts("OS: Apple 64\n"); puts("OS: Apple 64");
# else # else
puts("OS: Apple 32\n"); puts("OS: Apple 32");
# endif # endif
#endif #endif
printf("CUDA version: %d\n\n", CUDART_VERSION);
int deviceCount = cv::gpu::getCudaEnabledDeviceCount(); int deviceCount = cv::gpu::getCudaEnabledDeviceCount();
printf("CUDA version: %d\n", CUDART_VERSION);
printf("Found %d CUDA devices\n\n", deviceCount); printf("CUDA device count: %d\n\n", deviceCount);
for (int i = 0; i < deviceCount; ++i) for (int i = 0; i < deviceCount; ++i)
{ {
cv::gpu::DeviceInfo info(i); cv::gpu::DeviceInfo info(i);
printf("Device %d:\n", i); printf("Device %d:\n", i);
printf("\tName: %s\n", info.name().c_str()); printf(" Name: %s\n", info.name().c_str());
printf("\tCompute capability version: %d.%d\n", info.majorVersion(), info.minorVersion()); printf(" Compute capability version: %d.%d\n", info.majorVersion(), info.minorVersion());
printf("\tTotal memory: %d Mb\n", static_cast<int>(static_cast<int>(info.totalMemory() / 1024.0) / 1024.0)); printf(" Total memory: %d Mb\n", static_cast<int>(static_cast<int>(info.totalMemory() / 1024.0) / 1024.0));
printf("\tFree memory: %d Mb\n", static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0)); printf(" Free memory: %d Mb\n", static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0));
if (info.isCompatible()) 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 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:"); puts("GPU module was compiled for the following GPU archs:");
printf("\tBIN:%s\n", CUDA_ARCH_BIN); printf(" BIN: %s\n", CUDA_ARCH_BIN);
printf("\tPTX:%s\n\n", CUDA_ARCH_PTX); printf(" PTX: %s\n\n", CUDA_ARCH_PTX);
} }
enum OutputLevel enum OutputLevel
......
...@@ -337,9 +337,11 @@ TEST_P(SetTo, Masked) ...@@ -337,9 +337,11 @@ TEST_P(SetTo, Masked)
static cv::Scalar s = cv::Scalar(1, 2, 3, 4); static cv::Scalar s = cv::Scalar(1, 2, 3, 4);
cv::Mat mat;
cv::RNG& rng = cvtest::TS::ptr()->get_rng(); 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( ASSERT_NO_THROW(
cv::gpu::GpuMat dev_mat(mat_gold); cv::gpu::GpuMat dev_mat(mat_gold);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment