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

Method areResourcesSufficient

src/tests/performance/perf-gemm2.cpp:177–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175 * run the test case
176 */
177template <typename ElemType> bool
178GemmPerformanceTest<ElemType>::areResourcesSufficient(TestParams *params)
179{
180 clMath::BlasBase *base;
181 size_t gmemSize, allocSize, maxMatrSize;
182 bool ret = true;
183 size_t m = params->M, n = params->N, k = params->K;
184
185 if((A_ == NULL) || (backC_ == NULL) || (C_ == NULL) || (B_ == NULL))
186 {
187 return 0;
188 }
189
190 base = clMath::BlasBase::getInstance();
191 gmemSize = (size_t)base->availGlobalMemSize(0);
192 allocSize = (size_t)base->maxMemAllocSize();
193
194 if (base->useImages()) {
195 maxMatrSize = gmemSize / 5;
196 ret = (k < base->scratchImageWidth() *
197 sizeof(cl_float4) / sizeof(ElemType));
198 }
199 else {
200 maxMatrSize = gmemSize / 3;
201 }
202 maxMatrSize = std::min(maxMatrSize, allocSize);
203
204 if (ret) {
205 ret = ((std::max(m, n) * k * sizeof(ElemType) < maxMatrSize) &&
206 (m * n * sizeof(ElemType) < maxMatrSize));
207 }
208
209 return ret;
210}
211
212template <typename ElemType> int
213GemmPerformanceTest<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