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

Method areResourcesSufficient

src/tests/performance/perf-spr2.cpp:166–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 * run the test case
165 */
166template <typename ElemType> bool
167Spr2PerformanceTest<ElemType>::areResourcesSufficient(TestParams *params)
168{
169 clMath::BlasBase *base;
170 size_t gmemSize, allocSize;
171 size_t n = params->N;
172
173 if((AP_ == NULL) || (backAP_ == NULL) || (X_ == NULL) || (Y_ == NULL))
174 {
175 return 0;
176 }
177
178 base = clMath::BlasBase::getInstance();
179 gmemSize = (size_t)base->availGlobalMemSize(0);
180 allocSize = (size_t)base->maxMemAllocSize();
181
182 bool suff = ( (sizeof(ElemType)*( params_.N*( params_.N + 1 ) )/2 )< allocSize ) && ((1 + (n-1)*abs(params->incx))*sizeof(ElemType) < allocSize)
183 && ((1 + (n-1)*abs(params->incy))*sizeof(ElemType) < allocSize); //for individual allocations
184 suff = suff && (((( ( params_.N*( params_.N + 1 ) )/2 )+ (1 + (n-1)*abs(params->incx)) + (1 + (n-1)*abs(params->incy)))*sizeof(ElemType)) < gmemSize) ; //for total global allocations
185
186 return suff ;
187}
188
189template <typename ElemType> int
190Spr2PerformanceTest<ElemType>::prepare(void)

Callers 1

runInstanceMethod · 0.45

Calls 2

availGlobalMemSizeMethod · 0.80
maxMemAllocSizeMethod · 0.80

Tested by

no test coverage detected