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

Method clblasPerfSingle

src/tests/performance/perf-syr2k.cpp:250–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248
249
250template <typename ElemType> nano_time_t
251Syr2kPerformanceTest<ElemType>::clblasPerfSingle(void)
252{
253 nano_time_t time;
254 cl_event event;
255 cl_int status;
256 cl_command_queue queue = base_->commandQueues()[0];
257
258 status = clEnqueueWriteBuffer(queue, mobjC_, CL_TRUE, 0,
259 params_.rowsC * params_.columnsC *
260 sizeof(ElemType), backC_, 0, NULL, &event);
261 if (status != CL_SUCCESS) {
262 cerr << "Matrix C buffer object enqueuing error, status = " <<
263 status << endl;
264
265 return NANOTIME_ERR;
266 }
267
268 status = clWaitForEvents(1, &event);
269 if (status != CL_SUCCESS) {
270 cout << "Wait on event failed, status = " <<
271 status << endl;
272
273 return NANOTIME_ERR;
274 }
275
276 event = NULL;
277 status = (cl_int)clMath::clblas::syr2k(params_.order,
278 params_.uplo, params_.transA, params_.N, params_.K, alpha_,
279 mobjA_, params_.offA, params_.lda, mobjB_, params_.offBX, params_.ldb,
280 beta_, mobjC_, params_.offCY, params_.ldc, 1, &queue, 0, NULL, &event);
281 if (status != CL_SUCCESS) {
282 cerr << "The CLBLAS SYR2K function failed, status = " <<
283 status << endl;
284
285 return NANOTIME_ERR;
286 }
287 status = flushAll(1, &queue);
288 if (status != CL_SUCCESS) {
289 cerr << "clFlush() failed, status = " << status << endl;
290 return NANOTIME_ERR;
291 }
292
293 time = getCurrentTime();
294 status = waitForSuccessfulFinish(1, &queue, &event);
295 if (status == CL_SUCCESS) {
296 time = getCurrentTime() - time;
297 }
298 else {
299 cerr << "Waiting for completion of commands to the queue failed, "
300 "status = " << status << endl;
301 time = NANOTIME_ERR;
302 }
303
304 return time;
305}
306
307} // namespace clMath

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected