| 150 | * run the test case |
| 151 | */ |
| 152 | template <typename ElemType> bool |
| 153 | SprPerformanceTest<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 | |
| 174 | template <typename ElemType> int |
| 175 | SprPerformanceTest<ElemType>::prepare(void) |
no test coverage detected