| 227 | |
| 228 | |
| 229 | template <typename ElemType> nano_time_t |
| 230 | HprPerformanceTest<ElemType>::clblasPerfSingle(void) |
| 231 | { |
| 232 | nano_time_t time; |
| 233 | cl_event event; |
| 234 | cl_int status; |
| 235 | cl_command_queue queue = base_->commandQueues()[0]; |
| 236 | |
| 237 | status = clEnqueueWriteBuffer(queue, mobjAP_, CL_TRUE, 0, |
| 238 | ((( params_.N*( params_.N + 1 ) )/2 ) + params_.offa) * |
| 239 | sizeof(ElemType), backAP_, 0, NULL, &event); |
| 240 | if (status != CL_SUCCESS) { |
| 241 | cerr << "Matrix A buffer object enqueuing error, status = " << |
| 242 | status << endl; |
| 243 | |
| 244 | return NANOTIME_ERR; |
| 245 | } |
| 246 | |
| 247 | status = clWaitForEvents(1, &event); |
| 248 | if (status != CL_SUCCESS) { |
| 249 | cout << "Wait on event failed, status = " << |
| 250 | status << endl; |
| 251 | |
| 252 | return NANOTIME_ERR; |
| 253 | } |
| 254 | |
| 255 | event = NULL; |
| 256 | |
| 257 | #define TIMING |
| 258 | #ifdef TIMING |
| 259 | clFinish( queue); |
| 260 | time = getCurrentTime(); |
| 261 | |
| 262 | int iter = 20; |
| 263 | for ( int i = 1; i <= iter; i++) |
| 264 | { |
| 265 | #endif |
| 266 | status = (cl_int)clMath::clblas::hpr(params_.order, params_.uplo, params_.N, CREAL(alpha_), mobjX_, params_.offBX, params_.incx, |
| 267 | mobjAP_, params_.offa, 1, &queue, 0, NULL, &event); |
| 268 | |
| 269 | if (status != CL_SUCCESS) { |
| 270 | cerr << "The CLBLAS HPR function failed, status = " << |
| 271 | status << endl; |
| 272 | |
| 273 | return NANOTIME_ERR; |
| 274 | } |
| 275 | |
| 276 | #ifdef TIMING |
| 277 | } // iter loop |
| 278 | clFinish( queue); |
| 279 | time = getCurrentTime() - time; |
| 280 | time /= iter; |
| 281 | #else |
| 282 | status = flushAll(1, &queue); |
| 283 | if (status != CL_SUCCESS) { |
| 284 | cerr << "clFlush() failed, status = " << status << endl; |
| 285 | return NANOTIME_ERR; |
| 286 | } |
nothing calls this directly
no test coverage detected