add GPU module specific command line arguments
This commit is contained in:
@@ -1,3 +1,74 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
CV_PERF_TEST_MAIN(gpu)
|
||||
namespace{
|
||||
|
||||
static void printOsInfo()
|
||||
{
|
||||
#if defined _WIN32
|
||||
# if defined _WIN64
|
||||
printf("[----------]\n[ GPU INFO ] \tRun on OS Windows x64.\n[----------]\n"), fflush(stdout);
|
||||
# else
|
||||
printf("[----------]\n[ GPU INFO ] \tRun on OS Windows x32.\n[----------]\n"), fflush(stdout);
|
||||
# endif
|
||||
#elif defined linux
|
||||
# if defined _LP64
|
||||
printf("[----------]\n[ GPU INFO ] \tRun on OS Linux x64.\n[----------]\n"), fflush(stdout);
|
||||
# else
|
||||
printf("[----------]\n[ GPU INFO ] \tRun on OS Linux x32.\n[----------]\n"), fflush(stdout);
|
||||
# endif
|
||||
#elif defined __APPLE__
|
||||
# if defined _LP64
|
||||
printf("[----------]\n[ GPU INFO ] \tRun on OS Apple x64.\n[----------]\n"), fflush(stdout);
|
||||
# else
|
||||
printf("[----------]\n[ GPU INFO ] \tRun on OS Apple x32.\n[----------]\n"), fflush(stdout);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void printCudaInfo()
|
||||
{
|
||||
printOsInfo();
|
||||
#ifndef HAVE_CUDA
|
||||
printf("[----------]\n[ GPU INFO ] \tOpenCV was built without CUDA support.\n[----------]\n"), fflush(stdout);
|
||||
#else
|
||||
int driver;
|
||||
cudaDriverGetVersion(&driver);
|
||||
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
printf("[ GPU INFO ] \tCUDA Driver version: %d.\n", driver), fflush(stdout);
|
||||
printf("[ GPU INFO ] \tCUDA Runtime version: %d.\n", CUDART_VERSION), fflush(stdout);
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
printf("[ GPU INFO ] \tGPU module was compiled for the following GPU archs.\n"), fflush(stdout);
|
||||
printf("[ BIN ] \t%s.\n", CUDA_ARCH_BIN), fflush(stdout);
|
||||
printf("[ PTX ] \t%s.\n", CUDA_ARCH_PTX), fflush(stdout);
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
int deviceCount = cv::gpu::getCudaEnabledDeviceCount();
|
||||
printf("[ GPU INFO ] \tCUDA device count:: %d.\n", deviceCount), fflush(stdout);
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
|
||||
for (int i = 0; i < deviceCount; ++i)
|
||||
{
|
||||
cv::gpu::DeviceInfo info(i);
|
||||
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
printf("[ DEVICE ] \t# %d %s.\n", i, info.name().c_str()), fflush(stdout);
|
||||
printf("[ ] \tCompute capability: %d.%d\n", (int)info.majorVersion(), (int)info.minorVersion()), fflush(stdout);
|
||||
printf("[ ] \tMulti Processor Count: %d\n", info.multiProcessorCount()), fflush(stdout);
|
||||
printf("[ ] \tTotal memory: %d Mb\n", static_cast<int>(static_cast<int>(info.totalMemory() / 1024.0) / 1024.0)), fflush(stdout);
|
||||
printf("[ ] \tFree memory: %d Mb\n", static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0)), fflush(stdout);
|
||||
if (!info.isCompatible())
|
||||
printf("[ GPU INFO ] \tThis device is NOT compatible with current GPU module build\n");
|
||||
printf("[----------]\n"), fflush(stdout);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CV_PERF_TEST_MAIN(gpu, printCudaInfo())
|
@@ -188,69 +188,4 @@ void PrintTo(const CvtColorInfo& info, ostream* os)
|
||||
};
|
||||
|
||||
*os << str[info.code];
|
||||
}
|
||||
|
||||
void ts::printOsInfo()
|
||||
{
|
||||
#if defined _WIN32
|
||||
# if defined _WIN64
|
||||
cout << "OS: Windows x64 \n" << endl;
|
||||
# else
|
||||
cout << "OS: Windows x32 \n" << endl;
|
||||
# endif
|
||||
#elif defined linux
|
||||
# if defined _LP64
|
||||
cout << "OS: Linux x64 \n" << endl;
|
||||
# else
|
||||
cout << "OS: Linux x32 \n" << endl;
|
||||
# endif
|
||||
#elif defined __APPLE__
|
||||
# if defined _LP64
|
||||
cout << "OS: Apple x64 \n" << endl;
|
||||
# else
|
||||
cout << "OS: Apple x32 \n" << endl;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ts::printCudaInfo()
|
||||
{
|
||||
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
|
||||
cout << "OpenCV was built without CUDA support \n" << endl;
|
||||
#else
|
||||
int driver;
|
||||
cudaDriverGetVersion(&driver);
|
||||
|
||||
cout << "CUDA Driver version: " << driver << '\n';
|
||||
cout << "CUDA Runtime version: " << CUDART_VERSION << '\n';
|
||||
|
||||
cout << endl;
|
||||
|
||||
cout << "GPU module was compiled for the following GPU archs:" << endl;
|
||||
cout << " BIN: " << CUDA_ARCH_BIN << '\n';
|
||||
cout << " PTX: " << CUDA_ARCH_PTX << '\n';
|
||||
|
||||
cout << endl;
|
||||
|
||||
int deviceCount = getCudaEnabledDeviceCount();
|
||||
cout << "CUDA device count: " << deviceCount << '\n';
|
||||
|
||||
cout << endl;
|
||||
|
||||
for (int i = 0; i < deviceCount; ++i)
|
||||
{
|
||||
DeviceInfo info(i);
|
||||
|
||||
cout << "Device [" << i << "] \n";
|
||||
cout << "\t Name: " << info.name() << '\n';
|
||||
cout << "\t Compute capability: " << info.majorVersion() << '.' << info.minorVersion()<< '\n';
|
||||
cout << "\t Multi Processor Count: " << info.multiProcessorCount() << '\n';
|
||||
cout << "\t Total memory: " << static_cast<int>(static_cast<int>(info.totalMemory() / 1024.0) / 1024.0) << " Mb \n";
|
||||
cout << "\t Free memory: " << static_cast<int>(static_cast<int>(info.freeMemory() / 1024.0) / 1024.0) << " Mb \n";
|
||||
if (!info.isCompatible())
|
||||
cout << "\t !!! This device is NOT compatible with current GPU module build \n";
|
||||
|
||||
cout << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@@ -46,21 +46,16 @@ DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, MatDepth, MatCn);
|
||||
|
||||
#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::sz720p, perf::szSXGA, perf::sz1080p)
|
||||
|
||||
namespace ts {
|
||||
void printOsInfo();
|
||||
void printCudaInfo();
|
||||
}
|
||||
|
||||
#define GPU_SANITY_CHECK(dmat, ...) \
|
||||
do{ \
|
||||
cv::Mat d##dmat(dmat); \
|
||||
SANITY_CHECK(d##dmat, ## __VA_ARGS__); \
|
||||
} while(0);
|
||||
} while(0)
|
||||
|
||||
#define CPU_SANITY_CHECK(cmat, ...) \
|
||||
do{ \
|
||||
SANITY_CHECK(cmat, ## __VA_ARGS__); \
|
||||
} while(0);
|
||||
} while(0)
|
||||
|
||||
#define GPU_SANITY_CHECK_KEYPOINTS(alg, dmat, ...) \
|
||||
do{ \
|
||||
@@ -75,13 +70,13 @@ namespace ts {
|
||||
::perf::Regression::add(this, std::string(#dmat) + "-angle-row", __angle, ## __VA_ARGS__); \
|
||||
::perf::Regression::add(this, std::string(#dmat) + "octave-row", __octave, ## __VA_ARGS__); \
|
||||
::perf::Regression::add(this, std::string(#dmat) + "-pt-size-row", __size, ## __VA_ARGS__); \
|
||||
} while(0);
|
||||
} while(0)
|
||||
|
||||
#define GPU_SANITY_CHECK_RESPONSE(alg, dmat, ...) \
|
||||
do{ \
|
||||
cv::Mat d##dmat(dmat); \
|
||||
cv::Mat __response = d##dmat.row(cv::gpu::alg##_GPU::RESPONSE_ROW); \
|
||||
::perf::Regression::add(this, std::string(#dmat) + "-response-row", __response, ## __VA_ARGS__); \
|
||||
} while(0);
|
||||
} while(0)
|
||||
|
||||
#endif // __OPENCV_PERF_GPU_UTILITY_HPP__
|
||||
|
Reference in New Issue
Block a user