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

Function rotmgCorrectnessTest

src/tests/correctness/corr-rotmg.cpp:83–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82template <typename T>
83void
84rotmgCorrectnessTest(TestParams *params)
85{
86 cl_int err;
87 T *D1, *D2, *X, *Y, *PARAM;
88 T *back_D1, *back_D2, *back_X, *back_Y, *back_PARAM;
89 T sflagParam;
90 cl_mem bufD1, bufD2, bufX, bufY, bufParam;
91 clMath::BlasBase *base;
92 cl_event *events;
93 cl_double deltaForType = 0.0;
94
95 base = clMath::BlasBase::getInstance();
96
97 if ((typeid(T) == typeid(cl_double)) &&
98 !base->isDevSupportDoublePrecision())
99 {
100 std::cerr << ">> WARNING: The target device doesn't support native "
101 "double precision floating point arithmetic" <<
102 std::endl << ">> Test skipped" << std::endl;
103 SUCCEED();
104 return;
105 }
106
107 printf("number of command queues : %d\n\n", params->numCommandQueues);
108
109 events = new cl_event[params->numCommandQueues];
110 memset(events, 0, params->numCommandQueues * sizeof(cl_event));
111
112 X = new T[1 + params->offBX];
113 Y = new T[1 + params->offCY];
114 D1 = new T[1 + params->offa];
115 D2 = new T[1 + params->offb];
116 PARAM = new T[5 + params->offc]; //params always has 5 elements
117
118 back_X = new T[1 + params->offBX];
119 back_Y = new T[1 + params->offCY];
120 back_D1 = new T[1 + params->offa];
121 back_D2 = new T[1 + params->offb];
122 back_PARAM = new T[5 + params->offc]; //params always has 5 elements
123
124 if((D1 == NULL) || (D2 == NULL) || (X == NULL) || (Y == NULL) || (PARAM == NULL) ||
125 (back_D1 == NULL) || (back_D2 == NULL) ||(back_X == NULL) || (back_Y == NULL) || (back_PARAM == NULL))
126 {
127 ::std::cerr << "Cannot allocate memory on host side\n" << "!!!!!!!!!!!!Test skipped.!!!!!!!!!!!!" << ::std::endl;
128 deleteBuffers<T>(D1, D2, X, Y, PARAM);
129 deleteBuffers<T>(back_D1, back_D2, back_X, back_Y, back_PARAM);
130 delete[] events;
131 SUCCEED();
132 return;
133 }
134
135 srand(params->seed);
136
137 //Filling random values for SA and SB. C & S are only for output sake
138 randomRotmg( (D1 + params->offa), (D2 + params->offb),
139 (X + params->offBX), (Y + params->offCY), (PARAM + params->offc) );
140

Callers

nothing calls this directly

Calls 7

randomRotmgFunction · 0.85
printTestParamsFunction · 0.85
createEnqueueBufferMethod · 0.80
commandQueuesMethod · 0.80
releaseMemObjectsFunction · 0.70
waitForSuccessfulFinishFunction · 0.50

Tested by

no test coverage detected