| 249 | |
| 250 | |
| 251 | template <typename ElemType> nano_time_t |
| 252 | GemvPerformanceTest<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 | |
| 259 | status = clEnqueueWriteBuffer(queue, mobjC_, CL_TRUE, 0, |
| 260 | params_.rowsC * params_.columnsC * |
| 261 | sizeof(ElemType), backC_, 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 | status = (cl_int)clMath::clblas::gemv(params_.order, |
| 279 | params_.transA, params_.M, params_.N, alpha_, mobjA_, params_.offA, |
| 280 | params_.lda, mobjB_, params_.offBX, params_.incx, beta_, mobjC_, |
| 281 | params_.offCY, params_.incy, 1, &queue, 0, NULL, &event); |
| 282 | if (status != CL_SUCCESS) { |
| 283 | cerr << "The CLBLAS GEMV function failed, status = " << |
| 284 | status << endl; |
| 285 | |
| 286 | return NANOTIME_ERR; |
| 287 | } |
| 288 | status = flushAll(1, &queue); |
| 289 | if (status != CL_SUCCESS) { |
| 290 | cerr << "clFlush() failed, status = " << status << endl; |
| 291 | return NANOTIME_ERR; |
| 292 | } |
| 293 | |
| 294 | time = getCurrentTime(); |
| 295 | status = waitForSuccessfulFinish(1, &queue, &event); |
| 296 | if (status == CL_SUCCESS) { |
| 297 | time = getCurrentTime() - time; |
| 298 | } |
| 299 | else { |
| 300 | cerr << "Waiting for completion of commands to the queue failed, " |
| 301 | "status = " << status << endl; |
| 302 | time = NANOTIME_ERR; |
| 303 | } |
| 304 | |
| 305 | return time; |
| 306 | } |
| 307 | |
| 308 | } // namespace clMath |
nothing calls this directly
no test coverage detected