MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / clblasPerfSingle

Method clblasPerfSingle

src/tests/performance/perf-dotc.cpp:224–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222
223
224template <typename ElemType> nano_time_t
225DotcPerformanceTest<ElemType>::clblasPerfSingle(void)
226{
227 nano_time_t time;
228 cl_event event;
229 cl_int status;
230 cl_command_queue queue = base_->commandQueues()[0];
231
232 DataType type;
233 type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT:( typeid(ElemType) == typeid(double))? TYPE_DOUBLE:
234 ( typeid(ElemType) == typeid(FloatComplex))? TYPE_COMPLEX_FLOAT: TYPE_COMPLEX_DOUBLE;
235
236 event = NULL;
237 clFinish( queue);
238 time = getCurrentTime();
239
240#define TIMING
241#ifdef TIMING
242 int iter = 100;
243 for ( int i=1; i <= iter; i++)
244 {
245#endif
246
247 status = (cl_int)clMath::clblas::dot( type, params_.N, mobjDP_, params_.offa, mobjX_, params_.offBX, params_.incx,
248 mobjY_, params_.offCY, params_.incy, scratchBuff, 1, &queue, 0, NULL, &event);
249 if (status != CL_SUCCESS) {
250 cerr << "The CLBLAS DOT function failed, status = " <<
251 status << endl;
252
253 return NANOTIME_ERR;
254 }
255#ifdef TIMING
256 } // iter loop
257 clFinish( queue);
258 time = getCurrentTime() - time;
259 time /= iter;
260#else
261
262 status = flushAll(1, &queue);
263 if (status != CL_SUCCESS) {
264 cerr << "clFlush() failed, status = " << status << endl;
265 return NANOTIME_ERR;
266 }
267
268 time = getCurrentTime();
269 status = waitForSuccessfulFinish(1, &queue, &event);
270 if (status == CL_SUCCESS) {
271 time = getCurrentTime() - time;
272 }
273 else {
274 cerr << "Waiting for completion of commands to the queue failed, "
275 "status = " << status << endl;
276 time = NANOTIME_ERR;
277 }
278#endif
279 return time;
280}
281

Callers

nothing calls this directly

Calls 4

commandQueuesMethod · 0.80
getCurrentTimeFunction · 0.50
flushAllFunction · 0.50
waitForSuccessfulFinishFunction · 0.50

Tested by

no test coverage detected