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

Method areResourcesSufficient

src/tests/performance/perf-gemm.cpp:156–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154 * run the test case
155 */
156template <typename ElemType> bool
157GemmPerformanceTest<ElemType>::areResourcesSufficient(TestParams *params)
158{
159 clMath::BlasBase *base;
160 size_t gmemSize, allocSize, maxMatrSize;
161 bool ret = true;
162 size_t m = params->M, n = params->N, k = params->K;
163
164 base = clMath::BlasBase::getInstance();
165 gmemSize = (size_t)base->availGlobalMemSize(0);
166 allocSize = (size_t)base->maxMemAllocSize();
167
168 if (base->useImages()) {
169 maxMatrSize = gmemSize / 5;
170 ret = (k < base->scratchImageWidth() *
171 sizeof(cl_float4) / sizeof(ElemType));
172 }
173 else {
174 maxMatrSize = gmemSize / 3;
175 }
176 maxMatrSize = std::min(maxMatrSize, allocSize);
177
178 if (ret) {
179 ret = ((std::max(m, n) * k * sizeof(ElemType) < maxMatrSize) &&
180 (m * n * sizeof(ElemType) < maxMatrSize));
181 }
182
183 return ret;
184}
185
186template <typename ElemType> int
187GemmPerformanceTest<ElemType>::prepare(void)

Callers 1

runInstanceMethod · 0.45

Calls 4

availGlobalMemSizeMethod · 0.80
maxMemAllocSizeMethod · 0.80
useImagesMethod · 0.80
scratchImageWidthMethod · 0.80

Tested by

no test coverage detected