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