| 250 | |
| 251 | |
| 252 | template <typename ElemType> nano_time_t |
| 253 | HemvPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 254 | { |
| 255 | nano_time_t time; |
| 256 | cl_event event; |
| 257 | cl_int status; |
| 258 | cl_command_queue queue = base_->commandQueues()[0]; |
| 259 | int lenY = 1 + (params_.N-1) * abs(params_.incy); |
| 260 | |
| 261 | status = clEnqueueWriteBuffer(queue, mobjY_, CL_TRUE, 0, |
| 262 | (lenY + params_.offCY )* sizeof(ElemType), backY_, 0, NULL, &event); |
| 263 | if (status != CL_SUCCESS) { |
| 264 | cerr << "Vector Y buffer object enqueuing error, status = " << |
| 265 | status << endl; |
| 266 | |
| 267 | return NANOTIME_ERR; |
| 268 | } |
| 269 | |
| 270 | status = clWaitForEvents(1, &event); |
| 271 | if (status != CL_SUCCESS) { |
| 272 | cout << "Wait on event failed, status = " << |
| 273 | status << endl; |
| 274 | |
| 275 | return NANOTIME_ERR; |
| 276 | } |
| 277 | |
| 278 | event = NULL; |
| 279 | |
| 280 | time = getCurrentTime(); |
| 281 | #define TIMING |
| 282 | #ifdef TIMING |
| 283 | |
| 284 | int iter = 20; |
| 285 | for ( int i = 1; i <= iter; i++) |
| 286 | { |
| 287 | #endif |
| 288 | status = (cl_int)clMath::clblas::hemv(params_.order, params_.uplo, params_.N, alpha, mobjA_, params_.offA, params_.lda, |
| 289 | mobjX_, params_.offBX, params_.incx, beta, mobjY_, params_.offCY, params_.incy, |
| 290 | 1, &queue, 0, NULL, &event); |
| 291 | |
| 292 | if (status != CL_SUCCESS) { |
| 293 | cerr << "The CLBLAS HEMV function failed, status = " << |
| 294 | status << endl; |
| 295 | |
| 296 | return NANOTIME_ERR; |
| 297 | } |
| 298 | |
| 299 | #ifdef TIMING |
| 300 | } // iter loop |
| 301 | clFinish( queue); |
| 302 | time = getCurrentTime() - time; |
| 303 | time /= iter; |
| 304 | #else |
| 305 | |
| 306 | status = flushAll(1, &queue); |
| 307 | if (status != CL_SUCCESS) { |
| 308 | cerr << "clFlush() failed, status = " << status << endl; |
| 309 | return NANOTIME_ERR; |
nothing calls this directly
no test coverage detected