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

Method clblasPerfSingle

src/tests/performance/perf-copy.cpp:211–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210
211template <typename ElemType> nano_time_t
212CopyPerformanceTest<ElemType>::clblasPerfSingle(void)
213{
214 nano_time_t time;
215 cl_event event;
216 cl_int status;
217 cl_command_queue queue = base_->commandQueues()[0];
218
219 DataType type;
220 type = ( typeid(ElemType) == typeid(float))? TYPE_FLOAT:( typeid(ElemType) == typeid(double))? TYPE_DOUBLE:
221 ( typeid(ElemType) == typeid(FloatComplex))? TYPE_COMPLEX_FLOAT: TYPE_COMPLEX_DOUBLE;
222
223 status = clEnqueueWriteBuffer(queue, mobjY_, CL_TRUE, 0,
224 (lengthY + params_.offCY) * sizeof(ElemType), backY_, 0, NULL, &event);
225 if (status != CL_SUCCESS)
226 {
227 cerr << "Vector Y buffer object enqueuing error, status = " <<
228 status << endl;
229
230 return NANOTIME_ERR;
231 }
232
233 status = clWaitForEvents(1, &event);
234 if (status != CL_SUCCESS)
235 {
236 cout << "Wait on event failed, status = " <<
237 status << endl;
238
239 return NANOTIME_ERR;
240 }
241
242 event = NULL;
243 time = getCurrentTime();
244
245#define TIMING
246#ifdef TIMING
247 clFinish( queue);
248 int iter = 100;
249 for ( int i=1; i <= iter; i++)
250 {
251#endif
252
253 status = (cl_int)clMath::clblas::copy(type, params_.N, mobjX_, params_.offBX, params_.incx,
254 mobjY_, params_.offCY, params_.incy, 1, &queue, 0, NULL, &event);
255 if (status != CL_SUCCESS) {
256 cerr << "The CLBLAS COPY function failed, status = " <<
257 status << endl;
258
259 return NANOTIME_ERR;
260 }
261#ifdef TIMING
262 } // iter loop
263 clFinish( queue);
264 time = getCurrentTime() - time;
265 time /= iter;
266#else
267
268 status = flushAll(1, &queue);

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