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

Function gemvCorrectnessTest

src/tests/correctness/corr-gemv.cpp:51–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50template <typename T>
51void
52gemvCorrectnessTest(TestParams *params)
53{
54 cl_int err;
55 T *A, *B, *blasC, *clblasC, *X, *Y;
56 T alpha, beta;
57 cl_mem bufA, bufB, bufC;
58 clMath::BlasBase *base;
59 bool useAlpha, useBeta;
60 cl_event *events;
61 size_t lenY, lenX;
62 bool isComplex;
63
64 base = clMath::BlasBase::getInstance();
65
66 if ((typeid(T) == typeid(cl_double) ||
67 typeid(T) == typeid(DoubleComplex)) &&
68 !base->isDevSupportDoublePrecision()) {
69
70 std::cerr << ">> WARNING: The target device doesn't support native "
71 "double precision floating point arithmetic" <<
72 std::endl << ">> Test skipped" << std::endl;
73 SUCCEED();
74 return;
75 }
76
77 isComplex = ((typeid(T) == typeid(FloatComplex)) ||
78 (typeid(T) == typeid(DoubleComplex)));
79 if (canCaseBeSkipped(params, isComplex)) {
80 std::cerr << ">> Test is skipped" << std::endl;
81 SUCCEED();
82 return;
83 }
84
85 useAlpha = base->useAlpha();
86 useBeta = base->useBeta();
87 beta = ZERO<T>();
88 alpha = ZERO<T>();
89
90 events = new cl_event[params->numCommandQueues];
91 memset(events, 0, params->numCommandQueues * sizeof(cl_event));
92
93 A = new T[params->rowsA * params->columnsA];
94 B = new T[params->rowsB * params->columnsB];
95 blasC = new T[params->rowsC * params->columnsC];
96 clblasC = new T[params->rowsC * params->columnsC];
97 X = &B[params->offBX];
98 Y = &blasC[params->offCY];
99
100 srand(params->seed);
101 if (useAlpha) {
102 alpha = convertMultiplier<T>(params->alpha);
103 }
104 if (useBeta) {
105 beta = convertMultiplier<T>(params->beta);
106 }
107
108 if (params->transA == clblasNoTrans) {

Callers

nothing calls this directly

Calls 13

canCaseBeSkippedFunction · 0.85
compareVectorsFunction · 0.85
printTestParamsFunction · 0.85
useAlphaMethod · 0.80
useBetaMethod · 0.80
createEnqueueBufferMethod · 0.80
commandQueuesMethod · 0.80
alphaMethod · 0.80
betaMethod · 0.80
releaseMemObjectsFunction · 0.70
gemvFunction · 0.50

Tested by

no test coverage detected