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

Function rotCorrectnessTest

src/tests/correctness/corr-rot.cpp:67–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66template <typename T>
67void
68rotCorrectnessTest(TestParams *params)
69{
70 cl_int err;
71 T *X, *Y, *back_X, *back_Y;
72 T alpha, beta;
73 cl_mem bufX, bufY;
74 clMath::BlasBase *base;
75 cl_event *events;
76
77 base = clMath::BlasBase::getInstance();
78
79 if ((typeid(T) == typeid(cl_double) || typeid(T) == typeid(DoubleComplex)) &&
80 !base->isDevSupportDoublePrecision())
81 {
82 std::cerr << ">> WARNING: The target device doesn't support native "
83 "double precision floating point arithmetic" <<
84 std::endl << ">> Test skipped" << std::endl;
85 SUCCEED();
86 return;
87 }
88
89 printf("number of command queues : %d\n\n", params->numCommandQueues);
90
91 events = new cl_event[params->numCommandQueues];
92 memset(events, 0, params->numCommandQueues * sizeof(cl_event));
93
94 size_t lengthx = 1 + (params->N - 1) * abs(params->incx);
95 size_t lengthy = 1 + (params->N - 1) * abs(params->incy);
96
97 X = new T[lengthx + params->offa];
98 Y = new T[lengthy + params->offb];
99
100 back_X = new T[lengthx + params->offa];
101 back_Y = new T[lengthy + params->offb];
102
103 if((X == NULL) || (Y == NULL) ||
104 (back_X == NULL) || (back_Y == NULL))
105 {
106 ::std::cerr << "Cannot allocate memory on host side\n" << "!!!!!!!!!!!!Test skipped.!!!!!!!!!!!!" << ::std::endl;
107 deleteBuffers<T>(X, Y, back_X, back_Y);
108 delete[] events;
109 SUCCEED();
110 return;
111 }
112
113 srand(params->seed);
114
115 //Filling random values for SA and SB. C & S are only for output sake
116 randomVectors(params->N, (X + params->offa), params->incx, (Y+params->offb), params->incy);
117
118 alpha = convertMultiplier<T>(params->alpha);
119 beta = convertMultiplier<T>(params->beta);
120
121 memcpy(back_X, X, (lengthx + params->offa) * sizeof(T));
122 memcpy(back_Y, Y, (lengthy + params->offb) * sizeof(T));
123
124 // Allocate buffers

Callers

nothing calls this directly

Calls 8

randomVectorsFunction · 0.85
printTestParamsFunction · 0.85
createEnqueueBufferMethod · 0.80
commandQueuesMethod · 0.80
releaseMemObjectsFunction · 0.70
deleteBuffersFunction · 0.70
waitForSuccessfulFinishFunction · 0.50

Tested by

no test coverage detected