MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / clblasPerfSingle

Method clblasPerfSingle

src/tests/performance/perf-swap.cpp:230–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228
229
230template <typename ElemType> nano_time_t
231SwapPerformanceTest<ElemType>::clblasPerfSingle(void)
232{
233 nano_time_t time;
234 cl_event event;
235 cl_int status;
236 cl_command_queue queue = base_->commandQueues()[0];
237
238 DataType type;
239 type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT:( typeid(ElemType) == typeid(double))? TYPE_DOUBLE:
240 ( typeid(ElemType) == typeid(FloatComplex))? TYPE_COMPLEX_FLOAT: TYPE_COMPLEX_DOUBLE;
241
242 status = clEnqueueWriteBuffer(queue, mobjX_, CL_TRUE, 0,
243 (lengthX + params_.offBX) * sizeof(ElemType), X_, 0, NULL, &event);
244 if (status != CL_SUCCESS)
245 {
246 cerr << "Vactor X buffer object enqueuing error, status = " <<
247 status << endl;
248
249 return NANOTIME_ERR;
250 }
251
252 status = clEnqueueWriteBuffer(queue, mobjY_, CL_TRUE, 0,
253 (lengthY + params_.offCY) * sizeof(ElemType), Y_, 0, NULL, &event);
254 if (status != CL_SUCCESS)
255 {
256 cerr << "Vector Y buffer object enqueuing error, status = " <<
257 status << endl;
258
259 return NANOTIME_ERR;
260 }
261
262 status = clWaitForEvents(1, &event);
263 if (status != CL_SUCCESS)
264 {
265 cout << "Wait on event failed, status = " <<
266 status << endl;
267
268 return NANOTIME_ERR;
269 }
270
271 event = NULL;
272 time = getCurrentTime();
273
274#define TIMING
275#ifdef TIMING
276 clFinish( queue);
277 int iter = 100;
278 for ( int i=1; i <= iter; i++)
279 {
280#endif
281
282 status = (cl_int)clMath::clblas::swap(type, params_.N, mobjX_, params_.offBX, params_.incx,
283 mobjY_, params_.offCY, params_.incy, 1, &queue, 0, NULL, &event);
284 if (status != CL_SUCCESS) {
285 cerr << "The CLBLAS SWAP function failed, status = " <<
286 status << endl;
287

Callers

nothing calls this directly

Calls 4

commandQueuesMethod · 0.80
getCurrentTimeFunction · 0.50
flushAllFunction · 0.50
waitForSuccessfulFinishFunction · 0.50

Tested by

no test coverage detected