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