| 245 | |
| 246 | |
| 247 | template <typename ElemType> nano_time_t |
| 248 | SprPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 249 | { |
| 250 | nano_time_t time; |
| 251 | cl_event event; |
| 252 | cl_int status; |
| 253 | cl_command_queue queue = base_->commandQueues()[0]; |
| 254 | |
| 255 | status = clEnqueueWriteBuffer(queue, mobjAP_, CL_TRUE, 0, |
| 256 | (((( params_.N * (params_.N + 1)) / 2)) + params_.offa) * |
| 257 | sizeof(ElemType), backAP_, 0, NULL, &event); |
| 258 | if (status != CL_SUCCESS) { |
| 259 | cerr << "Matrix A buffer object enqueuing error, status = " << |
| 260 | status << endl; |
| 261 | |
| 262 | return NANOTIME_ERR; |
| 263 | } |
| 264 | |
| 265 | status = clWaitForEvents(1, &event); |
| 266 | if (status != CL_SUCCESS) { |
| 267 | cout << "Wait on event failed, status = " << |
| 268 | status << endl; |
| 269 | |
| 270 | return NANOTIME_ERR; |
| 271 | } |
| 272 | |
| 273 | event = NULL; |
| 274 | |
| 275 | #define TIMING |
| 276 | #ifdef TIMING |
| 277 | clFinish( queue); |
| 278 | time = getCurrentTime(); |
| 279 | |
| 280 | int iter = 100; |
| 281 | for ( int i = 1; i <= iter; i++) |
| 282 | { |
| 283 | #endif |
| 284 | status = (cl_int)clMath::clblas::spr(params_.order, params_.uplo, params_.N, alpha_, mobjX_, params_.offBX, params_.incx, |
| 285 | mobjAP_, params_.offa, 1, &queue, 0, NULL, &event); |
| 286 | |
| 287 | if (status != CL_SUCCESS) { |
| 288 | cerr << "The CLBLAS SPR function failed, status = " << |
| 289 | status << endl; |
| 290 | |
| 291 | return NANOTIME_ERR; |
| 292 | } |
| 293 | |
| 294 | #ifdef TIMING |
| 295 | } // iter loop |
| 296 | clFinish( queue); |
| 297 | time = getCurrentTime() - time; |
| 298 | time /= iter; |
| 299 | #else |
| 300 | status = flushAll(1, &queue); |
| 301 | if (status != CL_SUCCESS) { |
| 302 | cerr << "clFlush() failed, status = " << status << endl; |
| 303 | return NANOTIME_ERR; |
| 304 | } |
nothing calls this directly
no test coverage detected