| 247 | |
| 248 | |
| 249 | template <typename ElemType> nano_time_t |
| 250 | RotPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 251 | { |
| 252 | nano_time_t time; |
| 253 | cl_event event; |
| 254 | cl_int status; |
| 255 | cl_command_queue queue = base_->commandQueues()[0]; |
| 256 | |
| 257 | //DataType type; |
| 258 | //type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT: TYPE_DOUBLE; |
| 259 | |
| 260 | status = clEnqueueWriteBuffer(queue, mobjX_, CL_TRUE, 0, (lengthx + params_.offa) * sizeof(ElemType), X_, 0, NULL, &event); |
| 261 | if (status != CL_SUCCESS) |
| 262 | { |
| 263 | cerr << "Vector X buffer object enqueuing error, status = " << status << endl; |
| 264 | return NANOTIME_ERR; |
| 265 | } |
| 266 | |
| 267 | status = clEnqueueWriteBuffer(queue, mobjY_, CL_TRUE, 0, (lengthy + params_.offb) * sizeof(ElemType), Y_, 0, NULL, &event); |
| 268 | if (status != CL_SUCCESS) |
| 269 | { |
| 270 | cerr << "Vector Y buffer object enqueuing error, status = " << status << endl; |
| 271 | return NANOTIME_ERR; |
| 272 | } |
| 273 | |
| 274 | status = clWaitForEvents(1, &event); |
| 275 | if (status != CL_SUCCESS) |
| 276 | { |
| 277 | cout << "Wait on event failed, status = " << status << endl; |
| 278 | return NANOTIME_ERR; |
| 279 | } |
| 280 | |
| 281 | event = NULL; |
| 282 | time = getCurrentTime(); |
| 283 | |
| 284 | #define TIMING |
| 285 | #ifdef TIMING |
| 286 | clFinish( queue); |
| 287 | int iter = 50; |
| 288 | for ( int i=1; i <= iter; i++) |
| 289 | { |
| 290 | #endif |
| 291 | status = (cl_int)clMath::clblas::rot(params_.N, mobjX_, params_.offa, params_.incx, mobjY_, params_.offb, params_.incy, |
| 292 | alpha, beta, 1, &queue, 0, NULL, &event); |
| 293 | if (status != CL_SUCCESS) |
| 294 | { |
| 295 | cerr << "The CLBLAS ROT function failed, status = " << status << endl; |
| 296 | return NANOTIME_ERR; |
| 297 | } |
| 298 | #ifdef TIMING |
| 299 | } // iter loop |
| 300 | clFinish( queue); |
| 301 | time = getCurrentTime() - time; |
| 302 | time /= iter; |
| 303 | #else |
| 304 | |
| 305 | status = flushAll(1, &queue); |
| 306 | if (status != CL_SUCCESS) |
nothing calls this directly
no test coverage detected