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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user