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

Method clblasPerfSingle

src/tests/performance/perf-tpmv.cpp:262–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261
262template <typename ElemType> nano_time_t
263TpmvPerformanceTest<ElemType>::clblasPerfSingle(void)
264{
265 nano_time_t time;
266 cl_event event;
267 cl_int status;
268 cl_command_queue queue = base_->commandQueues()[0];
269 size_t lenX = 1 + (params_.N-1) * abs(params_.incx);
270
271 status = clEnqueueWriteBuffer(queue, mobjX_, CL_TRUE, 0,
272 (lenX + params_.offBX )* sizeof(ElemType), backX_, 0, NULL, &event);
273 if (status != CL_SUCCESS) {
274 cerr << "Vector X buffer object enqueuing error, status = " <<
275 status << endl;
276
277 return NANOTIME_ERR;
278 }
279
280 status = clWaitForEvents(1, &event);
281 if (status != CL_SUCCESS) {
282 cout << "Wait on event failed, status = " <<
283 status << endl;
284
285 return NANOTIME_ERR;
286 }
287
288 event = NULL;
289
290 DataType type;
291 type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT:( typeid(ElemType) == typeid(double))? TYPE_DOUBLE:
292 ( typeid(ElemType) == typeid(FloatComplex))? TYPE_COMPLEX_FLOAT: TYPE_COMPLEX_DOUBLE;
293 time = getCurrentTime();
294#define TIMING
295#ifdef TIMING
296 clFinish( queue);
297
298 int iter = 20;
299 for ( int i = 1; i <= iter; i++)
300 {
301#endif
302 status = (cl_int)clMath::clblas::tpmv(type, params_.order, params_.uplo,
303 params_.transA, params_.diag, params_.N, mobjAP_, params_.offa,
304 mobjX_, params_.offBX, params_.incx, scratchBuff,
305 1, &queue, 0, NULL, &event);
306
307
308 if (status != CL_SUCCESS) {
309 cerr << "The CLBLAS TPMV function failed, status = " <<
310 status << endl;
311
312 return NANOTIME_ERR;
313 }
314
315#ifdef TIMING
316 } // iter loop
317 clFinish( queue);
318 time = getCurrentTime() - time;
319 time /= iter;

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