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

Method clblasPerfSingle

src/tests/performance/perf-rotmg.cpp:302–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301
302template <typename ElemType> nano_time_t
303RotmgPerformanceTest<ElemType>::clblasPerfSingle(void)
304{
305 nano_time_t time;
306 cl_event event;
307 cl_int status;
308 cl_command_queue queue = base_->commandQueues()[0];
309
310 DataType type;
311 type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT: TYPE_DOUBLE;
312
313 status = clEnqueueWriteBuffer(queue, mobjD1_, CL_TRUE, 0, (1 + params_.offa) * sizeof(ElemType), D1_, 0, NULL, &event);
314 if (status != CL_SUCCESS)
315 {
316 cerr << "Vector D1 buffer object enqueuing error, status = " << status << endl;
317 return NANOTIME_ERR;
318 }
319
320 status = clEnqueueWriteBuffer(queue, mobjD2_, CL_TRUE, 0, (1 + params_.offb) * sizeof(ElemType), D2_, 0, NULL, &event);
321 if (status != CL_SUCCESS)
322 {
323 cerr << "Vector D2 buffer object enqueuing error, status = " << status << endl;
324 return NANOTIME_ERR;
325 }
326 status = clEnqueueWriteBuffer(queue, mobjX_, CL_TRUE, 0, (1 + params_.offBX) * sizeof(ElemType), X_, 0, NULL, &event);
327 if (status != CL_SUCCESS)
328 {
329 cerr << "Vector X buffer object enqueuing error, status = " << status << endl;
330 return NANOTIME_ERR;
331 }
332
333 status = clEnqueueWriteBuffer(queue, mobjY_, CL_TRUE, 0, (1 + params_.offCY) * sizeof(ElemType), Y_, 0, NULL, &event);
334 if (status != CL_SUCCESS)
335 {
336 cerr << "Vector Y buffer object enqueuing error, status = " << status << endl;
337 return NANOTIME_ERR;
338 }
339
340 status = clEnqueueWriteBuffer(queue, mobjParam_, CL_TRUE, 0, (5 + params_.offc) * sizeof(ElemType), PARAM_, 0, NULL, &event);
341 if (status != CL_SUCCESS)
342 {
343 cerr << "Vector C buffer object enqueuing error, status = " << status << endl;
344 return NANOTIME_ERR;
345 }
346
347 status = clWaitForEvents(1, &event);
348 if (status != CL_SUCCESS)
349 {
350 cout << "Wait on event failed, status = " << status << endl;
351 return NANOTIME_ERR;
352 }
353
354 event = NULL;
355 time = getCurrentTime();
356
357#define TIMING
358#ifdef TIMING
359 clFinish( queue);

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