| 301 | |
| 302 | |
| 303 | template <typename ElemType> nano_time_t |
| 304 | GemmPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 305 | { |
| 306 | nano_time_t time; |
| 307 | cl_event event, gemmevent; |
| 308 | cl_int status; |
| 309 | cl_command_queue queue = base_->commandQueues()[0]; |
| 310 | |
| 311 | status = clEnqueueWriteBuffer(queue, mobjC_, CL_TRUE, 0, |
| 312 | params_.rowsC * params_.columnsC * |
| 313 | sizeof(ElemType), backC_, 0, NULL, &event); |
| 314 | if (status != CL_SUCCESS) { |
| 315 | cerr << "Matrix C buffer object enqueuing error, status = " << |
| 316 | status << endl; |
| 317 | |
| 318 | return NANOTIME_ERR; |
| 319 | } |
| 320 | |
| 321 | status = clWaitForEvents(1, &event); |
| 322 | if (status != CL_SUCCESS) { |
| 323 | cout << "Wait on event failed, status = " << |
| 324 | status << endl; |
| 325 | |
| 326 | return NANOTIME_ERR; |
| 327 | } |
| 328 | |
| 329 | event = NULL; |
| 330 | status = (cl_int)clMath::clblas::gemm2(params_.order, |
| 331 | params_.transA, params_.transB, params_.M, params_.N, params_.K, alpha_, |
| 332 | mobjA_, params_.offA, params_.lda, mobjB_, params_.offBX, params_.ldb, |
| 333 | beta_, mobjC_, params_.offCY, params_.ldc, 1, &queue, 0, NULL, &gemmevent); |
| 334 | if (status != CL_SUCCESS) { |
| 335 | cerr << "The CLBLAS GEMM function failed, status = " << |
| 336 | status << endl; |
| 337 | |
| 338 | return NANOTIME_ERR; |
| 339 | } |
| 340 | status = flushAll(1, &queue); |
| 341 | if (status != CL_SUCCESS) { |
| 342 | cerr << "clFlush() failed, status = " << status << endl; |
| 343 | return NANOTIME_ERR; |
| 344 | } |
| 345 | |
| 346 | time = getCurrentTime(); |
| 347 | status = waitForSuccessfulFinish(1, &queue, &gemmevent); |
| 348 | if (status == CL_SUCCESS) { |
| 349 | time = getCurrentTime() - time; |
| 350 | } |
| 351 | else { |
| 352 | cerr << "Waiting for completion of commands to the queue failed, " |
| 353 | "status = " << status << endl; |
| 354 | time = NANOTIME_ERR; |
| 355 | } |
| 356 | |
| 357 | //printf("Returning Time: %lu\n", time); |
| 358 | return time; |
| 359 | } |
| 360 |
nothing calls this directly
no test coverage detected