| 238 | |
| 239 | |
| 240 | template <typename ElemType> nano_time_t |
| 241 | TbmvPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 242 | { |
| 243 | nano_time_t time; |
| 244 | cl_event event; |
| 245 | cl_int status; |
| 246 | size_t lenX; |
| 247 | cl_command_queue queue = base_->commandQueues()[0]; |
| 248 | |
| 249 | lenX = (params_.N - 1)* params_.incx + 1 + params_.offBX; |
| 250 | status = clEnqueueWriteBuffer(queue, mobjX_, CL_TRUE, 0, |
| 251 | lenX * sizeof(ElemType), backX_, 0, NULL, &event); |
| 252 | |
| 253 | if (status != CL_SUCCESS) { |
| 254 | cerr << "Vector X buffer object enqueuing error, status = " << |
| 255 | status << endl; |
| 256 | |
| 257 | return NANOTIME_ERR; |
| 258 | } |
| 259 | |
| 260 | status = clWaitForEvents(1, &event); |
| 261 | if (status != CL_SUCCESS) { |
| 262 | cout << "Wait on event failed, status = " << |
| 263 | status << endl; |
| 264 | |
| 265 | return NANOTIME_ERR; |
| 266 | } |
| 267 | DataType type; |
| 268 | type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT:( typeid(ElemType) == typeid(double))? TYPE_DOUBLE: |
| 269 | ( typeid(ElemType) == typeid(FloatComplex))? TYPE_COMPLEX_FLOAT: TYPE_COMPLEX_DOUBLE; |
| 270 | |
| 271 | event = NULL; |
| 272 | time = getCurrentTime(); |
| 273 | int iter = 20; |
| 274 | for ( int i = 1; i <= iter; i++) |
| 275 | { |
| 276 | status = clMath::clblas::tbmv(type, params_.order, params_.uplo, params_.transA, params_.diag, params_.N, params_.K, |
| 277 | mobjA_, params_.offA, params_.lda, mobjX_, params_.offBX, params_.incx, |
| 278 | mobjScratch_, 1, &queue, 0, NULL, &event); |
| 279 | |
| 280 | if (status != CL_SUCCESS) { |
| 281 | cerr << "The CLBLAS TBMV function failed, status = " << |
| 282 | status << endl; |
| 283 | return NANOTIME_ERR; |
| 284 | } |
| 285 | } |
| 286 | clFinish( queue ); |
| 287 | time = getCurrentTime() - time; |
| 288 | time /= iter; |
| 289 | |
| 290 | return time; |
| 291 | } |
| 292 | |
| 293 | } // namespace clMath |
| 294 |
nothing calls this directly
no test coverage detected