| 264 | |
| 265 | |
| 266 | template <typename ElemType> nano_time_t |
| 267 | TrmvPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 268 | { |
| 269 | nano_time_t time; |
| 270 | cl_event event; |
| 271 | cl_int status; |
| 272 | cl_command_queue queue = base_->commandQueues()[0]; |
| 273 | size_t lenX = 1 + (params_.N-1) * abs(params_.incx); |
| 274 | |
| 275 | status = clEnqueueWriteBuffer(queue, mobjX_, CL_TRUE, 0, |
| 276 | (lenX + params_.offBX )* sizeof(ElemType), backX_, 0, NULL, &event); |
| 277 | if (status != CL_SUCCESS) { |
| 278 | cerr << "Vector X buffer object enqueuing error, status = " << |
| 279 | status << endl; |
| 280 | |
| 281 | return NANOTIME_ERR; |
| 282 | } |
| 283 | |
| 284 | status = clWaitForEvents(1, &event); |
| 285 | if (status != CL_SUCCESS) { |
| 286 | cout << "Wait on event failed, status = " << |
| 287 | status << endl; |
| 288 | |
| 289 | return NANOTIME_ERR; |
| 290 | } |
| 291 | |
| 292 | event = NULL; |
| 293 | |
| 294 | DataType type; |
| 295 | type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT:( typeid(ElemType) == typeid(double))? TYPE_DOUBLE: |
| 296 | ( typeid(ElemType) == typeid(FloatComplex))? TYPE_COMPLEX_FLOAT: TYPE_COMPLEX_DOUBLE; |
| 297 | time = getCurrentTime(); |
| 298 | #define TIMING |
| 299 | #ifdef TIMING |
| 300 | clFinish( queue); |
| 301 | |
| 302 | int iter = 20; |
| 303 | for ( int i = 1; i <= iter; i++) |
| 304 | { |
| 305 | #endif |
| 306 | status = (cl_int)clMath::clblas::trmv(type, params_.order, params_.uplo, |
| 307 | params_.transA, params_.diag, params_.N, mobjA_, params_.offa, params_.lda, |
| 308 | mobjX_, params_.offBX, params_.incx, scratchBuff, |
| 309 | 1, &queue, 0, NULL, &event); |
| 310 | |
| 311 | |
| 312 | if (status != CL_SUCCESS) { |
| 313 | cerr << "The CLBLAS TRMV function failed, status = " << |
| 314 | status << endl; |
| 315 | |
| 316 | return NANOTIME_ERR; |
| 317 | } |
| 318 | |
| 319 | #ifdef TIMING |
| 320 | } // iter loop |
| 321 | clFinish( queue); |
| 322 | time = getCurrentTime() - time; |
| 323 | time /= iter; |
nothing calls this directly
no test coverage detected