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

Function tpmvCorrectnessTest

src/tests/correctness/corr-tpmv.cpp:66–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65template <typename T>
66void
67tpmvCorrectnessTest(TestParams *params)
68{
69 cl_int err;
70 T *AP, *blasX, *clblasX;
71 cl_mem bufAP, bufX, bufXTemp;
72 clMath::BlasBase *base;
73 cl_event *events;
74
75 base = clMath::BlasBase::getInstance();
76
77 if ((typeid(T) == typeid(cl_double) ||
78 typeid(T) == typeid(DoubleComplex)) &&
79 !base->isDevSupportDoublePrecision()) {
80
81 std::cerr << ">> WARNING: The target device doesn't support native "
82 "double precision floating point arithmetic" <<
83 std::endl << ">> Test skipped" << std::endl;
84 SUCCEED();
85 return;
86 }
87
88 printf("number of command queues : %d\n\n", params->numCommandQueues);
89
90 events = new cl_event[params->numCommandQueues];
91 memset(events, 0, params->numCommandQueues * sizeof(cl_event));
92
93 size_t lengthAP = (params->N *( params->N + 1 ))/2 ;
94 size_t lengthX = (1 + ((params->N -1) * abs(params->incx)));
95
96 AP = new T[lengthAP + params->offa ];
97 blasX = new T[lengthX + params->offBX ];
98 clblasX = new T[lengthX + params->offBX ];
99
100 if((AP == NULL) || (blasX == NULL) || (clblasX == NULL))
101 {
102 ::std::cerr << "Cannot allocate memory on host side\n" << "!!!!!!!!!!!!Test skipped.!!!!!!!!!!!!" << ::std::endl;
103 deleteBuffers<T>(AP, blasX, clblasX);
104 delete[] events;
105 SUCCEED();
106 return;
107 }
108
109 srand(params->seed);
110
111 // Set data in A and X using populate() routine
112 int creationFlags = 0;
113 creationFlags = creationFlags | RANDOM_INIT | PACKED_MATRIX;
114
115 // Default is Column-Major
116 creationFlags = ( (params-> order) == clblasRowMajor)? (creationFlags | ROW_MAJOR_ORDER) : (creationFlags);
117 creationFlags = ( (params-> uplo) == clblasLower)? (creationFlags | LOWER_HALF_ONLY) : (creationFlags | UPPER_HALF_ONLY);
118 BlasRoutineID BlasFn = CLBLAS_TRMV;
119
120 // Populate A and blasX
121 populate( AP + params->offa, params-> N, params-> N, 0, BlasFn, creationFlags);
122 populate( blasX , (lengthX + params->offBX), 1, (lengthX + params->offBX), BlasFn);
123

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected