1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
14 // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other oclMaterials provided with the distribution.
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
30 // This software is provided by the copyright holders and contributors as is and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
43 #include "precomp.hpp"
45 int main(int argc, const char *argv[])
47 vector<ocl::Info> oclinfo;
48 int num_devices = getDevice(oclinfo);
52 cerr << "no device found\n";
58 for (size_t i = 0; i < oclinfo.size(); i++)
60 for (size_t j = 0; j < oclinfo[i].DeviceName.size(); j++)
62 printf("device %d: %s\n", devidx++, oclinfo[i].DeviceName[j].c_str());
66 redirectError(cvErrorCallback);
69 "{ h | help | false | print help message }"
70 "{ f | filter | | filter for test }"
71 "{ w | workdir | | set working directory }"
72 "{ l | list | false | show all tests }"
73 "{ d | device | 0 | device id }"
74 "{ i | iters | 10 | iteration count }"
75 "{ m | warmup | 1 | gpu warm up iteration count}"
76 "{ t | xtop | 1.1 | xfactor top boundary}"
77 "{ b | xbottom | 0.9 | xfactor bottom boundary}"
78 "{ v | verify | false | only run gpu once to verify if problems occur}";
80 CommandLineParser cmd(argc, argv, keys);
82 if (cmd.get<bool>("help"))
84 cout << "Avaible options:" << endl;
89 int device = cmd.get<int>("device");
91 if (device < 0 || device >= num_devices)
93 cerr << "Invalid device ID" << endl;
97 if (cmd.get<bool>("verify"))
99 TestSystem::instance().setNumIters(1);
100 TestSystem::instance().setGPUWarmupIters(0);
101 TestSystem::instance().setCPUIters(0);
106 for (size_t i = 0; i < oclinfo.size(); i++)
108 for (size_t j = 0; j < oclinfo[i].DeviceName.size(); j++, devidx++)
110 if (device == devidx)
112 ocl::setDevice(oclinfo[i], (int)j);
113 TestSystem::instance().setRecordName(oclinfo[i].DeviceName[j]);
114 printf("\nuse %d: %s\n", devidx, oclinfo[i].DeviceName[j].c_str());
122 string filter = cmd.get<string>("filter");
123 string workdir = cmd.get<string>("workdir");
124 bool list = cmd.get<bool>("list");
125 int iters = cmd.get<int>("iters");
126 int wu_iters = cmd.get<int>("warmup");
127 double x_top = cmd.get<double>("xtop");
128 double x_bottom = cmd.get<double>("xbottom");
130 TestSystem::instance().setTopThreshold(x_top);
131 TestSystem::instance().setBottomThreshold(x_bottom);
135 TestSystem::instance().setTestFilter(filter);
138 if (!workdir.empty())
140 if (workdir[workdir.size() - 1] != '/' && workdir[workdir.size() - 1] != '\\')
145 TestSystem::instance().setWorkingDir(workdir);
150 TestSystem::instance().setListMode(true);
153 TestSystem::instance().setNumIters(iters);
154 TestSystem::instance().setGPUWarmupIters(wu_iters);
156 TestSystem::instance().run();