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

Function hpmvCorrectnessTest

src/tests/correctness/corr-hpmv.cpp:70–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69template <typename T>
70void
71hpmvCorrectnessTest(TestParams *params)
72{
73 cl_int err;
74 T *AP, *X, *blasY, *clblasY;
75 cl_mem bufAP, bufX, bufY;
76 clMath::BlasBase *base;
77 cl_event *events;
78 T alpha, beta;
79
80 base = clMath::BlasBase::getInstance();
81
82 if ((typeid(T) == typeid(DoubleComplex)) &&
83 !base->isDevSupportDoublePrecision()) {
84
85 std::cerr << ">> WARNING: The target device doesn't support native "
86 "double precision floating point arithmetic" <<
87 std::endl << ">> Test skipped" << std::endl;
88 SUCCEED();
89 return;
90 }
91
92 printf("number of command queues : %d\n\n", params->numCommandQueues);
93
94 events = new cl_event[params->numCommandQueues];
95 memset(events, 0, params->numCommandQueues * sizeof(cl_event));
96
97 size_t lengthA = (params->N * (params->N + 1)) / 2;
98 size_t lengthX = (1 + ((params->N -1) * abs(params->incx)));
99 size_t lengthY = (1 + ((params->N -1) * abs(params->incy)));
100
101 AP = new T[lengthA + params->offA ];
102 X = new T[lengthX + params->offBX ];
103 blasY = new T[lengthY + params->offCY ];
104 clblasY = new T[lengthY + params->offCY ];
105
106 srand(params->seed);
107
108 if((AP == NULL) || (X == NULL) || (blasY == NULL) || (clblasY == NULL))
109 {
110 deleteBuffers<T>(AP, X, blasY, clblasY);
111 ::std::cerr << "Cannot allocate memory on host side\n" << "!!!!!!!!!!!!Test skipped.!!!!!!!!!!!!" << ::std::endl;
112 delete[] events;
113 SUCCEED();
114 return;
115 }
116
117 alpha = convertMultiplier<T>(params->alpha);
118 beta = convertMultiplier<T>(params->beta);
119
120 randomHemvMatrices(params->order, params->uplo, params->N, true, &alpha, (AP + params->offA), params->lda,
121 (X + params->offBX), params->incx, true, &beta, (blasY + params->offCY), params->incy);
122 // Copy blasY to clblasY
123 memcpy(clblasY, blasY, (lengthY + params->offCY)* sizeof(*blasY));
124
125 // Allocate buffers
126 bufAP = base->createEnqueueBuffer(AP, (lengthA + params->offA)* sizeof(*AP), 0, CL_MEM_READ_ONLY);
127 bufX = base->createEnqueueBuffer(X, (lengthX + params->offBX)* sizeof(*X), 0, CL_MEM_READ_ONLY);

Callers

nothing calls this directly

Calls 7

randomHemvMatricesFunction · 0.85
doConjugateFunction · 0.85
createEnqueueBufferMethod · 0.80
commandQueuesMethod · 0.80
releaseMemObjectsFunction · 0.70
waitForSuccessfulFinishFunction · 0.50

Tested by

no test coverage detected