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