MCPcopy Create free account
hub / github.com/CRVI/OpenCLIPP / runbench

Function runbench

Bench/src/main.cpp:133–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131//-------------------------------------------------------------------------------------------------
132template<class BenchableType>
133void runbench(const char* szBenchname, BenchableType& cBenchable)
134{
135 Libraries Libs[Libraries::NbLibs];
136
137 Libs[Libraries::CL].Available = true && cBenchable.HasCLTest();
138 Libs[Libraries::NPP].Available = NPP_AVAILABLE && cBenchable.HasNPPTest();
139 Libs[Libraries::IPP].Available = IPP_AVAILABLE;
140 Libs[Libraries::CV].Available = CV_AVAILABLE && cBenchable.HasCVTest();
141
142 for (int i = 0; i < Libraries::NbLibs; i++)
143 Libs[i].ID = (Libraries::ELibs) i;
144
145#ifndef FULL_TESTS
146 printf("%s", szBenchname);
147 for (int i = 0; i < Libraries::NbLibs; i++)
148 if (Libs[i].Available)
149 printf("\t%s\t", Libs[i].Name());
150
151 printf("\tComparison\n");
152#endif // FULL_TESTS
153
154 for(uint i = 0; i < BENCH_COUNT; i++)
155 {
156 CTimer Timer;
157
158 //Alloc the images and prepare the images
159 cBenchable.Create(BENCH_WIDTH[i], BENCH_HEIGHT[i]);
160
161 if (Libs[Libraries::IPP].Available)
162 {
163 //Warm up the cache
164 cBenchable.RunIPP();
165
166 //Run a few times to bench
167 Timer.Start();
168 for(uint j = 0; j < BENCH_ITERATIONS; j++)
169 {
170 cBenchable.RunIPP();
171 }
172 Libs[Libraries::IPP].Time = Timer.Readms() / BENCH_ITERATIONS;
173
174 Libs[Libraries::IPP].Success = true; // IPP is the reference - always consider it successful
175 }
176
177 std::string Result = "Success";
178
179 if (Libs[Libraries::CL].Available)
180 {
181 //Build the program
182 cBenchable.RunCL();
183
184 //Warm the cache
185 cBenchable.RunCL();
186
187 ocipFinish();
188
189 //Run a few times to bench
190 Timer.Start();

Callers

nothing calls this directly

Calls 15

CheckFunction · 0.85
NPP_CODEFunction · 0.85
HasCLTestMethod · 0.80
NameMethod · 0.80
StartMethod · 0.80
ReadmsMethod · 0.80
HasNPPTestMethod · 0.45
HasCVTestMethod · 0.45
CreateMethod · 0.45
RunIPPMethod · 0.45
RunCLMethod · 0.45
CompareCLMethod · 0.45

Tested by

no test coverage detected