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

Method clblasPerfSingle

src/tests/performance/perf-spr2.cpp:246–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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