refactor CV_CUDA_TEST_MAIN, use CV_TEST_MAIN for it

use CV_CUDA_TEST_MAIN for opencv_test_core to initialize CUDA
device information
This commit is contained in:
Vladislav Vinogradov
2014-12-23 17:43:14 +03:00
parent 8237418be6
commit b33f3bb2cc
4 changed files with 40 additions and 48 deletions

View File

@@ -190,6 +190,33 @@ namespace cvtest
}
}
void parseCudaDeviceOptions(int argc, char **argv)
{
cv::CommandLineParser cmd(argc, argv,
"{ cuda_device | -1 | CUDA device on which tests will be executed (-1 means all devices) }"
"{ h help | false | Print help info }"
);
if (cmd.has("help"))
{
std::cout << "\nAvailable options besides google test option: \n";
cmd.printMessage();
}
int device = cmd.get<int>("cuda_device");
if (device < 0)
{
cvtest::DeviceManager::instance().loadAll();
std::cout << "Run tests on all supported CUDA devices \n" << std::endl;
}
else
{
cvtest::DeviceManager::instance().load(device);
cv::cuda::DeviceInfo info(device);
std::cout << "Run tests on CUDA device " << device << " [" << info.name() << "] \n" << std::endl;
}
}
//////////////////////////////////////////////////////////////////////
// Additional assertion