added OS info to gpu tests

This commit is contained in:
Vladislav Vinogradov 2011-06-29 11:53:15 +00:00
parent e8d2dd212c
commit 52bdfbc7fc

View File

@ -44,9 +44,30 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
void print_info() void print_info()
{ {
#if defined _WIN32
# if define _WIN64
puts("OS: Windows 64\n");
# else
puts("OS: Windows 32\n");
# endif
#elif defined linux
# if defined _LP64
puts("OS: Linux 64\n");
# else
puts("OS: Linux 32\n");
# endif
#elif defined __APPLE__
# if defined _LP64
puts("OS: Apple 64\n");
# else
puts("OS: Apple 32\n");
# endif
#endif
int deviceCount = cv::gpu::getCudaEnabledDeviceCount(); int deviceCount = cv::gpu::getCudaEnabledDeviceCount();
printf("Found %d CUDA devices\n\n", deviceCount); printf("Found %d CUDA devices\n\n", deviceCount);
for (int i = 0; i < deviceCount; ++i) for (int i = 0; i < deviceCount; ++i)
@ -57,12 +78,13 @@ void print_info()
printf("\tCompute capability version: %d.%d\n", info.majorVersion(), info.minorVersion()); printf("\tCompute 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("\tTotal 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("\tFree memory: %d Mb\n", static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0));
if (!info.isCompatible()) if (info.isCompatible())
printf("\tThis device is not compatible with current GPU module build\n"); puts("\tThis device is compatible with current GPU module build\n");
printf("\n"); else
puts("\tThis device is NOT compatible with current GPU module build\n");
} }
printf("GPU module was compiled for next GPU archs:\n"); puts("GPU module was compiled for next GPU archs:");
printf("\tBIN:%s\n", CUDA_ARCH_BIN); printf("\tBIN:%s\n", CUDA_ARCH_BIN);
printf("\tPTX:%s\n\n", CUDA_ARCH_PTX); printf("\tPTX:%s\n\n", CUDA_ARCH_PTX);
} }
@ -104,4 +126,4 @@ int main(int argc, char** argv)
return 0; return 0;
} }
#endif // HAVE_CUDA #endif // HAVE_CUDA