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

Function sprCorrectnessTest

src/tests/correctness/corr-spr.cpp:63–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61
62template <typename T>
63void
64sprCorrectnessTest(TestParams *params)
65{
66 cl_int err;
67 T *blasAP, *clblasAP, *X;
68// T *tempA;
69 cl_mem bufAP, bufX;
70 clMath::BlasBase *base;
71 cl_event *events;
72 bool useAlpha;
73 T alpha;
74
75 base = clMath::BlasBase::getInstance();
76
77 if ((typeid(T) == typeid(cl_double)) &&
78 !base->isDevSupportDoublePrecision()) {
79
80 std::cerr << ">> WARNING: The target device doesn't support native "
81 "double precision floating point arithmetic" <<
82 std::endl << ">> Test skipped" << std::endl;
83 SUCCEED();
84 return;
85 }
86
87 printf("number of command queues : %d\n\n", params->numCommandQueues);
88
89 events = new cl_event[params->numCommandQueues];
90 memset(events, 0, params->numCommandQueues * sizeof(cl_event));
91
92 size_t lengthAP = ( ( params->N*( params->N + 1 ) )/2 );
93 size_t lengthX = (1 + ((params->N -1) * abs(params->incx)));
94
95 blasAP = new T[lengthAP + params->offa];
96 clblasAP = new T[lengthAP + params->offa];
97 X = new T[lengthX + params->offBX];
98// tempA = new T[lengthA + params->offa ];
99
100 srand(params->seed);
101
102 memset(blasAP, -1, (lengthAP + params->offa));
103 memset(clblasAP, -1, (lengthAP + params->offa));
104 memset(X, -1, (lengthX + params->offBX));
105
106 alpha = convertMultiplier<T>(params->alpha);
107 useAlpha = true;
108
109 #ifdef DEBUG_SPR
110 printf("ALPHA in CORR_SPR.CPP %f\n", alpha);
111 #endif
112
113 if((blasAP == NULL) || (X == NULL) || (clblasAP == NULL))
114 {
115 ::std::cerr << "Cannot allocate memory on host side\n" << "!!!!!!!!!!!!Test skipped.!!!!!!!!!!!!" << ::std::endl;
116 deleteBuffers<T>(blasAP, clblasAP, X);
117 delete[] events;
118 SUCCEED();
119 return;
120 }

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected