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

Method areResourcesSufficient

src/tests/performance/perf-spr.cpp:152–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150 * run the test case
151 */
152template <typename ElemType> bool
153SprPerformanceTest<ElemType>::areResourcesSufficient(TestParams *params)
154{
155 clMath::BlasBase *base;
156 size_t gmemSize, allocSize;
157 size_t n = params->N;
158
159 if((AP_ == NULL) || (backAP_ == NULL) || (X_ == NULL))
160 {
161 return 0;
162 }
163
164 base = clMath::BlasBase::getInstance();
165 gmemSize = (size_t)base->availGlobalMemSize( 0 );
166 allocSize = (size_t)base->maxMemAllocSize();
167
168 bool suff = ( sizeof(ElemType)*( ( n*( n + 1 ) )/2 ) < allocSize ) && ((1 + (n-1)*abs(params->incx))*sizeof(ElemType) < allocSize); //for individual allocations
169 suff = suff && (((( (n *(n + 1 ) )/2 )+ (1 + (n-1)*abs(params->incx))*2)*sizeof(ElemType)) < gmemSize) ; //for total global allocations
170
171 return suff ;
172}
173
174template <typename ElemType> int
175SprPerformanceTest<ElemType>::prepare(void)

Callers 1

runInstanceMethod · 0.45

Calls 2

availGlobalMemSizeMethod · 0.80
maxMemAllocSizeMethod · 0.80

Tested by

no test coverage detected