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

Method clblasPerfSingle

src/tests/performance/perf-hpmv.cpp:251–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249
250
251template <typename ElemType> nano_time_t
252HpmvPerformanceTest<ElemType>::clblasPerfSingle(void)
253{
254 nano_time_t time;
255 cl_event event;
256 cl_int status;
257 cl_command_queue queue = base_->commandQueues()[0];
258 int lenY = 1 + (params_.N-1) * abs(params_.incy);
259
260 status = clEnqueueWriteBuffer(queue, mobjY_, CL_TRUE, 0,
261 (lenY + params_.offCY )* sizeof(ElemType), backY_, 0, NULL, &event);
262 if (status != CL_SUCCESS) {
263 cerr << "Vector Y buffer object enqueuing error, status = " <<
264 status << endl;
265
266 return NANOTIME_ERR;
267 }
268
269 status = clWaitForEvents(1, &event);
270 if (status != CL_SUCCESS) {
271 cout << "Wait on event failed, status = " <<
272 status << endl;
273
274 return NANOTIME_ERR;
275 }
276
277 event = NULL;
278
279 time = getCurrentTime();
280#define TIMING
281#ifdef TIMING
282
283 int iter = 20;
284 for ( int i = 1; i <= iter; i++)
285 {
286#endif
287 status = (cl_int)clMath::clblas::hpmv(params_.order, params_.uplo, params_.N, alpha, mobjAP_, params_.offA,
288 mobjX_, params_.offBX, params_.incx, beta, mobjY_, params_.offCY, params_.incy,
289 1, &queue, 0, NULL, &event);
290
291 if (status != CL_SUCCESS) {
292 cerr << "The CLBLAS HPMV function failed, status = " <<
293 status << endl;
294
295 return NANOTIME_ERR;
296 }
297
298#ifdef TIMING
299 } // iter loop
300 clFinish( queue);
301 time = getCurrentTime() - time;
302 time /= iter;
303#else
304
305 status = flushAll(1, &queue);
306 if (status != CL_SUCCESS) {
307 cerr << "clFlush() failed, status = " << status << endl;
308 return NANOTIME_ERR;

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