Changeset 9ee2ce3 for thirdparty/SZ/sz/include
- Timestamp:
- 09/28/18 16:32:55 (6 years ago)
- Branches:
- master, pympi
- Children:
- e6aa0eb
- Parents:
- abca157
- git-author:
- Hal Finkel <hfinkel@…> (09/28/18 16:32:55)
- git-committer:
- Hal Finkel <hfinkel@…> (09/28/18 16:32:55)
- Location:
- thirdparty/SZ/sz/include
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
thirdparty/SZ/sz/include/TightDataPointStorageD.h
r2c47b73 r9ee2ce3 23 23 char reqLength; 24 24 char radExpo; //used to compute reqLength based on segmented precisions in "pw_rel_compression" 25 26 double minLogValue; 25 27 26 28 int stateNum; … … 53 55 unsigned char* pwrErrBoundBytes; 54 56 int pwrErrBoundBytes_size; 57 58 unsigned char* raBytes; 59 size_t raBytes_size; 60 55 61 } TightDataPointStorageD; 56 62 -
thirdparty/SZ/sz/include/TightDataPointStorageF.h
r2c47b73 r9ee2ce3 35 35 size_t rtypeArray_size; 36 36 37 float minLogValue; 38 37 39 unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1) 38 40 size_t typeArray_size; … … 55 57 unsigned char* pwrErrBoundBytes; 56 58 int pwrErrBoundBytes_size; 59 60 unsigned char* raBytes; 61 size_t raBytes_size; 57 62 58 63 } TightDataPointStorageF; -
thirdparty/SZ/sz/include/TypeManager.h
r2c47b73 r9ee2ce3 20 20 //TypeManager.c 21 21 size_t convertIntArray2ByteArray_fast_1b(unsigned char* intArray, size_t intArrayLength, unsigned char **result); 22 size_t convertIntArray2ByteArray_fast_1b_to_result(unsigned char* intArray, size_t intArrayLength, unsigned char *result); 22 23 void convertByteArray2IntArray_fast_1b(size_t intArrayLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray); 23 24 size_t convertIntArray2ByteArray_fast_2b(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char **result); 25 size_t convertIntArray2ByteArray_fast_2b_inplace(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char *result); 24 26 void convertByteArray2IntArray_fast_2b(size_t stepLength, unsigned char* byteArray, size_t byteArrayLength, unsigned char **intArray); 25 27 size_t convertIntArray2ByteArray_fast_3b(unsigned char* timeStepType, size_t timeStepTypeLength, unsigned char **result); -
thirdparty/SZ/sz/include/callZlib.h
r2c47b73 r9ee2ce3 19 19 20 20 #include <stdio.h> 21 22 int isZlibFormat(unsigned char magic1, unsigned char magic2); 21 23 22 24 //callZlib.c -
thirdparty/SZ/sz/include/dataCompression.h
r2c47b73 r9ee2ce3 78 78 int initRandomAccessBytes(unsigned char* raBytes); 79 79 80 int generateLossyCoefficients_float(float* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, float* medianValue, float* decData); 81 int compressExactDataArray_float(float* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, 82 int reqLength, int reqBytesLength, int resiBitsLength, float medianValue); 83 84 void decompressExactDataArray_float(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, float medianValue, float** decData); 85 86 int generateLossyCoefficients_double(double* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, double* medianValue, double* decData); 87 int compressExactDataArray_double(double* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, 88 int reqLength, int reqBytesLength, int resiBitsLength, double medianValue); 89 90 void decompressExactDataArray_double(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, double medianValue, double** decData); 91 80 92 #ifdef __cplusplus 81 93 } -
thirdparty/SZ/sz/include/pastriD.h
r2c47b73 r9ee2ce3 11 11 half.d=0.5; 12 12 13 //printf("pastri_double_quantize:\nx=%lf x=0x%lx\n",x,(*((uint64_t *)(&x))));14 //printf("sign(x):0x%lx\n", x);15 //printf("0.5:0x%lx\n", (*((uint64_t *)(&half))));13 // //printf("pastri_double_quantize:\nx=%lf x=0x%lx\n",x,(*((uint64_t *)(&x)))); 14 // //printf("sign(x):0x%lx\n", x); 15 // //printf("0.5:0x%lx\n", (*((uint64_t *)(&half)))); 16 16 half.ui64 |= (u1.ui64 & (uint64_t)0x8000000000000000); 17 //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half))));17 // //printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half)))); 18 18 return (int64_t)(x + half.d); 19 19 } … … 27 27 int i,sb; 28 28 for(i=0;i<p->bSize;i++){ 29 //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG29 // //printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG 30 30 if(abs_FastD(data[i])>p->usedEb){ 31 31 bp->nonZeros++; 32 // if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG32 ////if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG 33 33 } 34 34 if(abs_FastD(data[i])>absExt){ … … 43 43 bp->binSize=2*p->usedEb; 44 44 45 // if(DEBUG){printf("Extremum : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG46 // if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG47 48 // if(DEBUG){for(i=0;i<p->sbSize;i++){printf("pattern[%d]=data[%d]=%.6e Quantized:%d\n",i,patternIdx+i,data[patternIdx+i],pastri_double_quantize(data[patternIdx+i]/binSize) );} }//DEBUG45 ////if(DEBUG){printf("Extremum : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG 46 ////if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG 47 48 ////if(DEBUG){for(i=0;i<p->sbSize;i++){printf("pattern[%d]=data[%d]=%.6e Quantized:%d\n",i,patternIdx+i,data[patternIdx+i],pastri_double_quantize(data[patternIdx+i]/binSize) );} }//DEBUG 49 49 50 50 //int64_t *patternQ=(int64_t*)(outBuf+15); //Possible Improvement! … … 53 53 for(i=0;i<p->sbSize;i++){ 54 54 patternQ[i]=pastri_double_quantize(data[patternIdx+i],bp->binSize); 55 if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);}55 //if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);} 56 56 } 57 57 … … 59 59 bp->scaleBits=bp->patternBits; 60 60 bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->scaleBits-1))-1); 61 // if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG62 // if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG63 if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG61 ////if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG 62 ////if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG 63 //if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG 64 64 65 65 //Calculate Scales. … … 68 68 //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8); //Possible Improvement! 69 69 int patternExtZero=(patternExt==0); 70 // if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG70 ////if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG 71 71 for(sb=0;sb<p->sbNum;sb++){ 72 72 //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt; … … 74 74 //assert(scales[sb]<=1); 75 75 scalesQ[sb]=pastri_double_quantize((patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt),bp->scalesBinSize); 76 if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);}76 //if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);} 77 77 } 78 // if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG78 ////if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG 79 79 80 80 //int64_t *ECQ=(int64_t*)(outBuf+p->bSize*8); //ECQ is written into outBuf, just be careful when handling it. … … 93 93 if(absECQ > bp->ECQExt) 94 94 bp->ECQExt=absECQ; 95 // if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG95 ////if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG 96 96 switch (ECQ[_1DIdx]){ 97 97 case 0: … … 118 118 double decompressed=scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-ECQ[_1DIdx]*binSize; 119 119 if(abs_FastD(decompressed-data[_1DIdx])>(p->usedEb)){ 120 printf("p->usedEb=%.6e\n",p->usedEb);121 printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed));120 //printf("p->usedEb=%.6e\n",p->usedEb); 121 //printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed)); 122 122 assert(0); 123 123 } … … 175 175 //*(uint16_t*)(&outBuf[7])=p->idxOffset[3]; 176 176 177 if(D_W){printf("ECQ0s:%d ECQ1s:%d ECQOthers:%d Total:%d\n",p->bSize-bp->ECQ1s-bp->ECQOthers,bp->ECQ1s,bp->ECQOthers,p->bSize);} //DEBUG178 if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG177 //if(D_W){printf("ECQ0s:%d ECQ1s:%d ECQOthers:%d Total:%d\n",p->bSize-bp->ECQ1s-bp->ECQOthers,bp->ECQ1s,bp->ECQOthers,p->bSize);} //DEBUG 178 //if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG 179 179 180 180 //**************************************************************************************** … … 184 184 //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, indexOffsets, nonZeros, indexes, data 185 185 *numOutBytes=UCSparseBytes; 186 if(D_G){printf("UCSparse\n");} //DEBUG187 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG186 //if(D_G){printf("UCSparse\n");} //DEBUG 187 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 188 188 outBuf[0]=0; //mode 189 189 … … 217 217 } 218 218 219 if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG219 //if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG 220 220 221 221 //**************************************************************************************** … … 225 225 //Uncompressed, NonSparse bits. Includes: mode, indexOffsets, data 226 226 *numOutBytes=UCNonSparseBytes; 227 if(D_G){printf("UCNonSparse\n");} //DEBUG228 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG227 //if(D_G){printf("UCNonSparse\n");} //DEBUG 228 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 229 229 outBuf[0]=1; //mode 230 230 … … 232 232 memcpy(&outBuf[1], data, p->bSize*p->dataSize); 233 233 234 if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG234 //if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG 235 235 /* 236 236 for(i=0;i<UCNonSparseBytes-17;i++){ 237 printf("%d ",inBuf[p->bSize*8+i]);238 } 239 printf("\n");237 //printf("%d ",inBuf[p->bSize*8+i]); 238 } 239 //printf("\n"); 240 240 for(i=0;i<UCNonSparseBytes-17;i++){ 241 printf("%d ",outBuf[17+i]);242 } 243 printf("\n");241 //printf("%d ",outBuf[17+i]); 242 } 243 //printf("\n"); 244 244 */ 245 245 //**************************************************************************************** … … 249 249 //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ} 250 250 *numOutBytes=CSparseBytes; 251 if(D_G){printf("CSparse\n");} //DEBUG252 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG253 // if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG251 //if(D_G){printf("CSparse\n");} //DEBUG 252 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 253 ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 254 254 outBuf[0]=2; //mode 255 255 … … 270 270 bitPos=9*8; 271 271 272 // if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG272 ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 273 273 274 274 for(i=0;i<p->sbSize;i++){ 275 275 writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 276 276 } 277 // if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG277 ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 278 278 for(i=0;i<p->sbNum;i++){ 279 279 writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 280 280 } 281 // if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG282 // if(DEBUG)printf("ECQBits:%d\n",ECQBits);281 ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 282 ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 283 283 switch(bp->ECQBits){ 284 284 case 2: … … 288 288 break; 289 289 case 1: 290 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG290 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG 291 291 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 292 292 //writeBits_Fast(outBuf,&bitPos,2,0x10); … … 296 296 break; 297 297 case -1: 298 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG298 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 299 299 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 300 300 //writeBits_Fast(outBuf,&bitPos,2,0x11); … … 315 315 break; 316 316 case 1: 317 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG317 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG 318 318 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 319 319 //writeBits_Fast(outBuf,&bitPos,3,0);//0x000 … … 323 323 break; 324 324 case -1: 325 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG325 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG 326 326 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 327 327 //writeBits_Fast(outBuf,&bitPos,3,1);//0x001 … … 331 331 break; 332 332 default: 333 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG333 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG 334 334 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 335 335 //writeBits_Fast(outBuf,&bitPos,2+ECQBits,((uint64_t)0x11<<ECQBits)|ECQ[i]); … … 344 344 } 345 345 346 // if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG347 if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG346 ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 347 //if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG 348 348 349 349 … … 352 352 *(uint32_t*)(&outBuf[1])=bytePos; 353 353 354 if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG354 //if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG 355 355 if(D_G){assert(bitPos==CSparseBits);} 356 356 … … 360 360 //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,P, S, {ECQ} 361 361 *numOutBytes=CNonSparseBytes; 362 if(D_G){printf("CNonSparse\n");} //DEBUG363 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG364 // if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG362 //if(D_G){printf("CNonSparse\n");} //DEBUG 363 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 364 ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 365 365 outBuf[0]=3; //mode 366 366 … … 375 375 bitPos=7*8; //Currently, we are at the end of 7th byte. 376 376 377 // if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG377 ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 378 378 379 379 for(i=0;i<p->sbSize;i++){ 380 380 writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 381 381 } 382 // if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG382 ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 383 383 for(i=0;i<p->sbNum;i++){ 384 384 writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 385 385 } 386 // if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG387 // if(DEBUG)printf("ECQBits:%d\n",ECQBits);386 ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 387 ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 388 388 switch(bp->ECQBits){ 389 389 case 2: … … 391 391 switch(ECQ[i]){ 392 392 case 0: 393 // if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG393 ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG 394 394 writeBits_Fast(outBuf,&bitPos,1,1);//0x1 395 395 break; 396 396 case 1: 397 // if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG397 ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG 398 398 //writeBits_Fast(outBuf,&bitPos,2,0);//0x00 399 399 writeBits_Fast(outBuf,&bitPos,1,0); … … 401 401 break; 402 402 case -1: 403 // if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG403 ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG 404 404 //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 405 405 writeBits_Fast(outBuf,&bitPos,1,0); … … 413 413 break; 414 414 default: //ECQBits>2 415 // if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG415 ////if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG 416 416 for(i=0;i<p->bSize;i++){ 417 // if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG418 // if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG419 // if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG417 ////if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 418 ////if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG 419 ////if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG 420 420 switch(ECQ[i]){ 421 421 case 0: 422 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG423 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG422 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 423 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 424 424 //temp1=bitPos; 425 425 writeBits_Fast(outBuf,&bitPos,1,1); //0x1 426 426 //wVal=1; writeBits_Fast(outBuf,&bitPos,1,wVal); //0x1 427 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG427 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 428 428 break; 429 429 case 1: 430 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG431 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG430 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG 431 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 432 432 //temp1=bitPos; 433 433 //writeBits_Fast(outBuf,&bitPos,3,0); //0x000 … … 436 436 writeBits_Fast(outBuf,&bitPos,1,0); 437 437 //wVal=0; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x000 438 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG438 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 439 439 break; 440 440 case -1: 441 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG442 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG441 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG 442 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 443 443 //temp1=bitPos; 444 444 //writeBits_Fast(outBuf,&bitPos,3,8); //0x001 … … 447 447 writeBits_Fast(outBuf,&bitPos,1,1); 448 448 //wVal=8; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x001 449 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG449 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 450 450 break; 451 451 default: 452 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG453 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG452 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG 453 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 454 454 //temp1=bitPos; 455 455 //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 … … 458 458 //wVal=2; writeBits_Fast(outBuf,&bitPos,2,wVal); //0x01 459 459 writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]); 460 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG460 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 461 461 break; 462 462 } … … 465 465 } 466 466 467 // if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG468 if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG467 ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 468 //if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG 469 469 470 470 … … 474 474 *(uint32_t*)(&outBuf[1])=bytePos; 475 475 476 if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG476 //if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG 477 477 if(D_G){assert(bitPos==CNonSparseBits);} 478 478 479 479 } 480 // for(i=213;i<233;i++)if(DEBUG)printf("AMG_WE:bitPos:%d buffer[%d]=0x%lx\n",i*8,i,*(uint64_t*)(&outBuf[i])); //DEBUG480 ////for(i=213;i<233;i++)if(DEBUG)printf("AMG_WE:bitPos:%d buffer[%d]=0x%lx\n",i*8,i,*(uint64_t*)(&outBuf[i])); //DEBUG 481 481 482 482 } … … 484 484 pastri_blockParams bp; 485 485 486 if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);} //DEBUG487 if(D_G2){printf("Parameters: bfs:%d %d %d %d originalEb:%.3e\n",p->bf[0],p->bf[1],p->bf[2],p->bf[3],p->usedEb);} //DEBUG488 if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG489 if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG486 //if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);} //DEBUG 487 //if(D_G2){printf("Parameters: bfs:%d %d %d %d originalEb:%.3e\n",p->bf[0],p->bf[1],p->bf[2],p->bf[3],p->usedEb);} //DEBUG 488 //if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG 489 //if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG 490 490 491 491 int64_t patternQ[MAX_PS_SIZE]; … … 567 567 //R:UCSparse 568 568 case 0: 569 if(D_G){printf("\nDC:UCSparse\n");} //DEBUG569 //if(D_G){printf("\nDC:UCSparse\n");} //DEBUG 570 570 //bp->nonZeros=*(uint16_t*)(&inBuf[9]); 571 571 //bytePos=11; … … 592 592 bytePos+=8; 593 593 } 594 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG594 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 595 595 break; 596 596 //R:UCNonSparse 597 597 case 1: 598 if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG598 //if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG 599 599 //memcpy(&outBuf[p->bSize*8], &inBuf[9], p->bSize*8); 600 600 memcpy(data, &inBuf[1], p->bSize*8); 601 601 bytePos=p->bSize*8; 602 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG602 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 603 603 break; 604 604 //R:CSparse 605 605 case 2: 606 if(D_G){printf("\nDC:CSparse\n");} //DEBUG606 //if(D_G){printf("\nDC:CSparse\n");} //DEBUG 607 607 //for(j=0;j<p->bSize;j++){ 608 608 // data[j]=0; … … 615 615 bp->ECQBits=inBuf[6]; 616 616 617 if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG617 //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 618 618 619 619 //bp->numOutliers=*(uint16_t*)(&inBuf[15]); … … 621 621 bp->numOutliers=*(uint16_t*)(&inBuf[7]); 622 622 bitPos=9*8; 623 if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG623 //if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG 624 624 625 625 bp->scalesBinSize=1/(double)(((uint64_t)1<<(bp->patternBits-1))-1); … … 627 627 bp->binSize=p->usedEb*2; 628 628 629 if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG629 //if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG 630 630 631 631 for(j=0;j<p->sbSize;j++){ 632 632 patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 633 if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}633 //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 634 634 } 635 635 for(j=0;j<p->sbNum;j++){ 636 636 scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 637 if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}637 //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 638 638 } 639 639 … … 649 649 case 2: 650 650 for(j=0;j<bp->numOutliers;j++){ 651 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG652 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG651 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 652 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 653 653 654 654 _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 655 655 ECQTemp=readBits_I64(inBuf,&bitPos,1); 656 656 ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 657 // if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);657 ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 658 658 //continue; 659 659 //sb=_1DIdx/p->sbSize; … … 663 663 ECQ[_1DIdx]=ECQTemp; 664 664 665 // if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG665 ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 666 666 } 667 667 break; 668 668 default: //bp->ECQBits>2 669 if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: bp->ECQBits:%d bp->numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG669 //if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: bp->ECQBits:%d bp->numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG 670 670 671 671 for(j=0;j<bp->numOutliers;j++){ … … 674 674 //localIdx=_1DIdx%p->sbSize; 675 675 temp=readBits_UI64(inBuf,&bitPos,1); 676 // if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG676 ////if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG 677 677 switch(temp){ 678 678 case 0: //+-1 679 679 ECQTemp=readBits_I64(inBuf,&bitPos,1); 680 680 ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 681 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG682 // if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);681 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 682 ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 683 683 break; 684 684 case 1: //Others 685 685 ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 686 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG687 // if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);686 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 687 ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 688 688 break; 689 689 //default: 690 // printf("ERROR: Bad 2-bit value: 0x%lx",temp);690 //// printf("ERROR: Bad 2-bit value: 0x%lx",temp); 691 691 // assert(0); //AMG 692 692 // break; … … 696 696 ECQ[_1DIdx]=ECQTemp; 697 697 698 // if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG698 ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 699 699 } 700 700 break; … … 705 705 706 706 bytePos=(bitPos+7)/8; 707 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG707 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 708 708 709 709 //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) … … 713 713 //R:CNonSparse 714 714 case 3: 715 if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG715 //if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG 716 716 717 717 //for(j=0;j<p->bSize;j++){ … … 725 725 bp->ECQBits=inBuf[6]; 726 726 727 if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG727 //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 728 728 729 729 //bitPos=15*8; … … 733 733 bp->binSize=p->usedEb*2; 734 734 735 if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG735 //if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG 736 736 737 737 for(j=0;j<p->sbSize;j++){ 738 738 patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 739 if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}739 //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 740 740 } 741 741 for(j=0;j<p->sbNum;j++){ 742 742 scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 743 if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}743 //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 744 744 } 745 745 /* //Splitting 746 746 for(j=0;j<p->bSize;j++){ 747 747 data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize; 748 // if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);}748 ////if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);} 749 749 } 750 750 */ … … 752 752 case 2: 753 753 for(j=0;j<p->bSize;j++){ 754 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG755 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG754 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 755 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 756 756 //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 757 757 temp=readBits_UI64(inBuf,&bitPos,1); … … 769 769 } 770 770 771 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG771 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 772 772 //continue; 773 773 //sb=_1DIdx/p->sbSize; … … 777 777 ECQ[j]=ECQTemp; 778 778 779 // if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG779 ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 780 780 } 781 781 break; 782 782 default: //bp->ECQBits>2 783 // if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos);783 ////if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos); 784 784 785 785 for(j=0;j<p->bSize;j++){ 786 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG787 // if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos);788 789 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG790 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG786 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 787 ////if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos); 788 789 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 790 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 791 791 //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 792 792 temp=readBits_UI64(inBuf,&bitPos,1); 793 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG793 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 794 794 switch(temp){ 795 795 case 0: 796 // if(DEBUG)printf("Read:0");796 ////if(DEBUG)printf("Read:0"); 797 797 temp2=readBits_UI64(inBuf,&bitPos,1); 798 798 switch(temp2){ 799 799 case 0: 800 // if(DEBUG)printf("0");800 ////if(DEBUG)printf("0"); 801 801 ECQTemp=readBits_I64(inBuf,&bitPos,1); 802 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG803 // if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp);802 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 803 ////if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp); 804 804 ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 805 // if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);805 ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 806 806 break; 807 807 case 1: 808 // if(DEBUG)printf("1\n");808 ////if(DEBUG)printf("1\n"); 809 809 ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 810 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG811 // if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);810 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 811 ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 812 812 break; 813 813 default: … … 817 817 break; 818 818 case 1: 819 // if(DEBUG)printf("Read:1\n");819 ////if(DEBUG)printf("Read:1\n"); 820 820 ECQTemp=0; 821 // if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);821 ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 822 822 break; 823 823 default: … … 826 826 } 827 827 828 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG828 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 829 829 //continue; 830 830 //sb=_1DIdx/p->sbSize; … … 834 834 ECQ[j]=ECQTemp; 835 835 836 // if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG836 ////if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG 837 837 } 838 838 break; … … 842 842 //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8); 843 843 bytePos=(bitPos+7)/8; 844 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG844 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 845 845 846 846 //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) … … 880 880 for(i=0;i<p->bSize;i++){ 881 881 if(idx0[i]!=idx0_dc[i]){ 882 printf("idx0[%d]=%d != %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i);882 //printf("idx0[%d]=%d != %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i); 883 883 assert(0); 884 884 } 885 885 if(idx1[i]!=idx1_dc[i]){ 886 printf("idx1[%d]=%d != %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i);886 //printf("idx1[%d]=%d != %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i); 887 887 assert(0); 888 888 } 889 889 if(idx2[i]!=idx2_dc[i]){ 890 printf("idx2[%d]=%d != %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i);890 //printf("idx2[%d]=%d != %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i); 891 891 assert(0); 892 892 } 893 893 if(idx3[i]!=idx3_dc[i]){ 894 printf("idx3[%d]=%d != %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i);894 //printf("idx3[%d]=%d != %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i); 895 895 assert(0); 896 896 } … … 901 901 for(i=0;i<p->bSize;i++){ 902 902 if(abs_FastD(data[i]-data_dc[i])>p->usedEb){ 903 printf("|data[%d]-data_dc[%d]|>originalEb : %.3e - %.3e = %.3e > %.3e\n",i,i,data[i],data_dc[i],abs_FastD(data[i]-data_dc[i]),p->usedEb);903 //printf("|data[%d]-data_dc[%d]|>originalEb : %.3e - %.3e = %.3e > %.3e\n",i,i,data[i],data_dc[i],abs_FastD(data[i]-data_dc[i]),p->usedEb); 904 904 assert(0); 905 905 } -
thirdparty/SZ/sz/include/pastriF.h
r2c47b73 r9ee2ce3 11 11 half.d=0.5; 12 12 13 // printf("pastri_float_quantize:\nx=%lf x=0x%lx\n",x,(*((uint64_t *)(&x))));14 // printf("sign(x):0x%lx\n", x);15 // printf("0.5:0x%lx\n", (*((uint64_t *)(&half))));13 ////printf("pastri_float_quantize:\nx=%lf x=0x%lx\n",x,(*((uint64_t *)(&x)))); 14 ////printf("sign(x):0x%lx\n", x); 15 ////printf("0.5:0x%lx\n", (*((uint64_t *)(&half)))); 16 16 half.ui64 |= (u1.ui64 & (uint64_t)0x8000000000000000); 17 // printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half))));17 ////printf("sign(x)*0.5:0x%lx\n", (*((uint64_t *)(&half)))); 18 18 return (int64_t)(x + half.d); 19 19 } … … 27 27 int i,sb; 28 28 for(i=0;i<p->bSize;i++){ 29 // printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG29 ////printf("data[%d] = %.16lf\n",i,data[i]);//DEBUG 30 30 if(abs_FastD(data[i])>p->usedEb){ 31 31 bp->nonZeros++; 32 // if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG32 ////if(DEBUG)printf("data[%d]:%.6e\n",i,data[i]); //DEBUG 33 33 } 34 34 if(abs_FastD(data[i])>absExt){ … … 43 43 bp->binSize=2*p->usedEb; 44 44 45 // if(DEBUG){printf("Extremum : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG46 // if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG47 48 // if(DEBUG){for(i=0;i<p->sbSize;i++){printf("pattern[%d]=data[%d]=%.6e Quantized:%d\n",i,patternIdx+i,data[patternIdx+i],pastri_float_quantize(data[patternIdx+i]/binSize) );} }//DEBUG45 ////if(DEBUG){printf("Extremum : data[%d] = %.6e\n",extIdx,patternExt);} //DEBUG 46 ////if(DEBUG){printf("patternIdx: %d\n",patternIdx);} //DEBUG 47 48 ////if(DEBUG){for(i=0;i<p->sbSize;i++){printf("pattern[%d]=data[%d]=%.6e Quantized:%d\n",i,patternIdx+i,data[patternIdx+i],pastri_float_quantize(data[patternIdx+i]/binSize) );} }//DEBUG 49 49 50 50 //int64_t *patternQ=(int64_t*)(outBuf+15); //Possible Improvement! … … 53 53 for(i=0;i<p->sbSize;i++){ 54 54 patternQ[i]=pastri_float_quantize(data[patternIdx+i],bp->binSize); 55 if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);}55 //if(D_W){printf("patternQ[%d]=%ld\n",i,patternQ[i]);} 56 56 } 57 57 … … 59 59 bp->scaleBits=bp->patternBits; 60 60 bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->scaleBits-1))-1); 61 // if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG62 // if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG63 if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG61 ////if(DEBUG){printf("(patternExt/binSize)+1: %.6e\n",(patternExt/binSize)+1);} //DEBUG 62 ////if(DEBUG){printf("scaleBits=patternBits: %d\n",scaleBits);} //DEBUG 63 //if(D_W){printf("scalesBinSize: %.6e\n",bp->scalesBinSize);} //DEBUG 64 64 65 65 //Calculate Scales. … … 68 68 //int64_t *scalesQ=(int64_t*)(outBuf+15+p->sbSize*8); //Possible Improvement! 69 69 int patternExtZero=(patternExt==0); 70 // if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG70 ////if(DEBUG){printf("patternExtZero: %d\n",patternExtZero);} //DEBUG 71 71 for(sb=0;sb<p->sbNum;sb++){ 72 72 //scales[sb]=data[sb*p->sbSize+localExtIdx]/patternExt; … … 74 74 //assert(scales[sb]<=1); 75 75 scalesQ[sb]=pastri_float_quantize((patternExtZero ? 0 : data[sb*p->sbSize+localExtIdx]/patternExt),bp->scalesBinSize); 76 if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);}76 //if(D_W){printf("scalesQ[%d]=%ld\n",sb,scalesQ[sb]);} 77 77 } 78 // if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG78 ////if(DEBUG){for(i=0;i<p->sbSize;i++){printf("scalesQ[%d]=%ld \n",i,scalesQ[i]);}} //DEBUG 79 79 80 80 //int64_t *ECQ=(int64_t*)(outBuf+p->bSize*8); //ECQ is written into outBuf, just be careful when handling it. … … 93 93 if(absECQ > bp->ECQExt) 94 94 bp->ECQExt=absECQ; 95 // if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG95 ////if(DEBUG){printf("EC[%d]: %.6e Quantized:%ld \n",_1DIdx,(scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-data[_1DIdx]),ECQ[_1DIdx]);} //DEBUG 96 96 switch (ECQ[_1DIdx]){ 97 97 case 0: … … 118 118 float decompressed=scalesQ[sb]*patternQ[i]*scalesBinSize*binSize-ECQ[_1DIdx]*binSize; 119 119 if(abs_FastD(decompressed-data[_1DIdx])>(p->usedEb)){ 120 printf("p->usedEb=%.6e\n",p->usedEb);121 printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed));120 //printf("p->usedEb=%.6e\n",p->usedEb); 121 //printf("data[%d]=%.6e decompressed[%d]=%.6e diff=%.6e\n",_1DIdx,data[_1DIdx],_1DIdx,decompressed,abs_FastD(data[_1DIdx]-decompressed)); 122 122 assert(0); 123 123 } … … 175 175 //*(uint16_t*)(&outBuf[7])=p->idxOffset[3]; 176 176 177 if(D_W){printf("ECQ0s:%d ECQ1s:%d ECQOthers:%d Total:%d\n",p->bSize-bp->ECQ1s-bp->ECQOthers,bp->ECQ1s,bp->ECQOthers,p->bSize);} //DEBUG178 if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG177 //if(D_W){printf("ECQ0s:%d ECQ1s:%d ECQOthers:%d Total:%d\n",p->bSize-bp->ECQ1s-bp->ECQOthers,bp->ECQ1s,bp->ECQOthers,p->bSize);} //DEBUG 178 //if(D_W){printf("numOutliers:%d\n",bp->numOutliers);} //DEBUG 179 179 180 180 //**************************************************************************************** … … 184 184 //Uncompressed, Sparse bits. Just like the original GAMESS data. Includes: mode, indexOffsets, nonZeros, indexes, data 185 185 *numOutBytes=UCSparseBytes; 186 if(D_G){printf("UCSparse\n");} //DEBUG187 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG186 //if(D_G){printf("UCSparse\n");} //DEBUG 187 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 188 188 outBuf[0]=0; //mode 189 189 … … 217 217 } 218 218 219 if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG219 //if(D_G)printf("UCSparseBytes:%d \n",UCSparseBytes); //DEBUG 220 220 221 221 //**************************************************************************************** … … 225 225 //Uncompressed, NonSparse bits. Includes: mode, indexOffsets, data 226 226 *numOutBytes=UCNonSparseBytes; 227 if(D_G){printf("UCNonSparse\n");} //DEBUG228 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG227 //if(D_G){printf("UCNonSparse\n");} //DEBUG 228 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 229 229 outBuf[0]=1; //mode 230 230 … … 232 232 memcpy(&outBuf[1], data, p->bSize*p->dataSize); 233 233 234 if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG234 //if(D_G)printf("UCNonSparseBytes:%d \n",UCNonSparseBytes); //DEBUG 235 235 /* 236 236 for(i=0;i<UCNonSparseBytes-17;i++){ 237 printf("%d ",inBuf[p->bSize*8+i]);238 } 239 printf("\n");237 //printf("%d ",inBuf[p->bSize*8+i]); 238 } 239 //printf("\n"); 240 240 for(i=0;i<UCNonSparseBytes-17;i++){ 241 printf("%d ",outBuf[17+i]);242 } 243 printf("\n");241 //printf("%d ",outBuf[17+i]); 242 } 243 //printf("\n"); 244 244 */ 245 245 //**************************************************************************************** … … 249 249 //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,numOutliers,P, S, {Indexes(Sparse), ECQ} 250 250 *numOutBytes=CSparseBytes; 251 if(D_G){printf("CSparse\n");} //DEBUG252 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG253 // if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG251 //if(D_G){printf("CSparse\n");} //DEBUG 252 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 253 ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 254 254 outBuf[0]=2; //mode 255 255 … … 270 270 bitPos=9*8; 271 271 272 // if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG272 ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 273 273 274 274 for(i=0;i<p->sbSize;i++){ 275 275 writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 276 276 } 277 // if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG277 ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 278 278 for(i=0;i<p->sbNum;i++){ 279 279 writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 280 280 } 281 // if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG282 // if(DEBUG)printf("ECQBits:%d\n",ECQBits);281 ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 282 ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 283 283 switch(bp->ECQBits){ 284 284 case 2: … … 288 288 break; 289 289 case 1: 290 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG290 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x0\n",i,ECQ[i]); //DEBUG 291 291 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 292 292 //writeBits_Fast(outBuf,&bitPos,2,0x10); … … 296 296 break; 297 297 case -1: 298 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG298 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 299 299 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 300 300 //writeBits_Fast(outBuf,&bitPos,2,0x11); … … 315 315 break; 316 316 case 1: 317 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG317 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x00\n",i,ECQ[i]); //DEBUG 318 318 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 319 319 //writeBits_Fast(outBuf,&bitPos,3,0);//0x000 … … 323 323 break; 324 324 case -1: 325 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG325 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01\n",i,ECQ[i]); //DEBUG 326 326 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 327 327 //writeBits_Fast(outBuf,&bitPos,3,1);//0x001 … … 331 331 break; 332 332 default: 333 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG333 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1 0x%lx\n",i,ECQ[i],ECQ[i]); //DEBUG 334 334 writeBits_Fast(outBuf,&bitPos,bp->_1DIdxBits,i); 335 335 //writeBits_Fast(outBuf,&bitPos,2+ECQBits,((uint64_t)0x11<<ECQBits)|ECQ[i]); … … 344 344 } 345 345 346 // if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG347 if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG346 ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 347 //if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG 348 348 349 349 … … 352 352 *(uint32_t*)(&outBuf[1])=bytePos; 353 353 354 if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG354 //if(D_G)printf("bitPos:%ld CSparseBits:%d bytePos:%d CSparseBytes:%d\n",bitPos,CSparseBits,bytePos,CSparseBytes); //DEBUG 355 355 if(D_G){assert(bitPos==CSparseBits);} 356 356 … … 360 360 //Includes: mode, indexOffsets, compressedBytes, patternBits, ECQBits,P, S, {ECQ} 361 361 *numOutBytes=CNonSparseBytes; 362 if(D_G){printf("CNonSparse\n");} //DEBUG363 if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG364 // if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG362 //if(D_G){printf("CNonSparse\n");} //DEBUG 363 //if(D_G)printf("ECQBits:%d\n",bp->ECQBits); //DEBUG 364 ////if(DEBUG){printf("patternBits:%d _1DIdxBits:%d\n",patternBits,_1DIdxBits);} //DEBUG 365 365 outBuf[0]=3; //mode 366 366 … … 375 375 bitPos=7*8; //Currently, we are at the end of 7th byte. 376 376 377 // if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG377 ////if(DEBUG){printf("bitPos_B:%ld\n",bitPos);} //DEBUG 378 378 379 379 for(i=0;i<p->sbSize;i++){ 380 380 writeBits_Fast(outBuf,&bitPos,bp->patternBits,patternQ[i]);//Pattern point 381 381 } 382 // if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG382 ////if(DEBUG){printf("bitPos_P:%ld\n",bitPos);} //DEBUG 383 383 for(i=0;i<p->sbNum;i++){ 384 384 writeBits_Fast(outBuf,&bitPos,bp->scaleBits,scalesQ[i]);//Scale 385 385 } 386 // if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG387 // if(DEBUG)printf("ECQBits:%d\n",ECQBits);386 ////if(DEBUG){printf("bitPos_S:%ld\n",bitPos);} //DEBUG 387 ////if(DEBUG)printf("ECQBits:%d\n",ECQBits); 388 388 switch(bp->ECQBits){ 389 389 case 2: … … 391 391 switch(ECQ[i]){ 392 392 case 0: 393 // if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG393 ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x1\n",i,ECQ[i]); //DEBUG 394 394 writeBits_Fast(outBuf,&bitPos,1,1);//0x1 395 395 break; 396 396 case 1: 397 // if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG397 ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x00\n",i,ECQ[i]); //DEBUG 398 398 //writeBits_Fast(outBuf,&bitPos,2,0);//0x00 399 399 writeBits_Fast(outBuf,&bitPos,1,0); … … 401 401 break; 402 402 case -1: 403 // if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG403 ////if(DEBUG)printf("Index:%d ECQ:%d Written:0x01\n",i,ECQ[i]); //DEBUG 404 404 //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 405 405 writeBits_Fast(outBuf,&bitPos,1,0); … … 413 413 break; 414 414 default: //ECQBits>2 415 // if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG415 ////if(DEBUG) printf("AMG_W1:bitPos:%ld\n",bitPos); //DEBUG 416 416 for(i=0;i<p->bSize;i++){ 417 // if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG418 // if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG419 // if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG417 ////if(DEBUG){printf("AMG_W3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 418 ////if(DEBUG) printf("AMG_W2:bitPos:%ld\n",bitPos); //DEBUG 419 ////if(DEBUG) printf("ECQ[%d]:%ld\n",i,ECQ[i]); //DEBUG 420 420 switch(ECQ[i]){ 421 421 case 0: 422 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG423 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG422 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x1\n",i,ECQ[i]); //DEBUG 423 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 424 424 //temp1=bitPos; 425 425 writeBits_Fast(outBuf,&bitPos,1,1); //0x1 426 426 //wVal=1; writeBits_Fast(outBuf,&bitPos,1,wVal); //0x1 427 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG427 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 428 428 break; 429 429 case 1: 430 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG431 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG430 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x000\n",i,ECQ[i]); //DEBUG 431 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 432 432 //temp1=bitPos; 433 433 //writeBits_Fast(outBuf,&bitPos,3,0); //0x000 … … 436 436 writeBits_Fast(outBuf,&bitPos,1,0); 437 437 //wVal=0; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x000 438 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG438 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 439 439 break; 440 440 case -1: 441 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG442 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG441 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x001\n",i,ECQ[i]); //DEBUG 442 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 443 443 //temp1=bitPos; 444 444 //writeBits_Fast(outBuf,&bitPos,3,8); //0x001 … … 447 447 writeBits_Fast(outBuf,&bitPos,1,1); 448 448 //wVal=8; writeBits_Fast(outBuf,&bitPos,3,wVal); //0x001 449 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG449 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 450 450 break; 451 451 default: 452 // if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG453 // if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG452 ////if(DEBUG)printf("Index:%d ECQ:%ld Written:0x01 0x%lx\n",i,ECQ[i]); //DEBUG 453 ////if(DEBUG){printf("AMG_WB3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&outBuf[bitPos/8]));}; //DEBUG 454 454 //temp1=bitPos; 455 455 //writeBits_Fast(outBuf,&bitPos,2,2); //0x01 … … 458 458 //wVal=2; writeBits_Fast(outBuf,&bitPos,2,wVal); //0x01 459 459 writeBits_Fast(outBuf,&bitPos,bp->ECQBits,ECQ[i]); 460 // if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG460 ////if(DEBUG){printf("AMG_WA3:bitPos:%ld buffer[%ld]=0x%lx\n",temp1,temp1/8,*(uint64_t*)(&outBuf[temp1/8]));}; //DEBUG 461 461 break; 462 462 } … … 465 465 } 466 466 467 // if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG468 if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG467 ////if(DEBUG){printf("bitPos_E:%ld\n",bitPos);} //DEBUG 468 //if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: ECQBits:%d numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG 469 469 470 470 … … 474 474 *(uint32_t*)(&outBuf[1])=bytePos; 475 475 476 if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG476 //if(D_G)printf("bitPos:%ld CNonSparseBits:%d bytePos:%d CNonSparseBytes:%d\n",bitPos,CNonSparseBits,bytePos,CNonSparseBytes); //DEBUG 477 477 if(D_G){assert(bitPos==CNonSparseBits);} 478 478 479 479 } 480 // for(i=213;i<233;i++)if(DEBUG)printf("AMG_WE:bitPos:%d buffer[%d]=0x%lx\n",i*8,i,*(uint64_t*)(&outBuf[i])); //DEBUG480 ////for(i=213;i<233;i++)if(DEBUG)printf("AMG_WE:bitPos:%d buffer[%d]=0x%lx\n",i*8,i,*(uint64_t*)(&outBuf[i])); //DEBUG 481 481 482 482 } … … 484 484 pastri_blockParams bp; 485 485 486 if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);} //DEBUG487 if(D_G2){printf("Parameters: bfs:%d %d %d %d originalEb:%.3e\n",p->bf[0],p->bf[1],p->bf[2],p->bf[3],p->usedEb);} //DEBUG488 if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG489 if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG486 //if(D_G2){printf("Parameters: dataSize:%d\n",p->dataSize);} //DEBUG 487 //if(D_G2){printf("Parameters: bfs:%d %d %d %d originalEb:%.3e\n",p->bf[0],p->bf[1],p->bf[2],p->bf[3],p->usedEb);} //DEBUG 488 //if(D_G2){printf("Parameters: idxRanges:%d %d %d %d\n",p->idxRange[0],p->idxRange[1],p->idxRange[2],p->idxRange[3]);} //DEBUG 489 //if(D_G2){printf("Parameters: sbSize:%d sbNum:%d bSize:%d\n",p->sbSize,p->sbNum,p->bSize); }//DEBUG 490 490 491 491 int64_t patternQ[MAX_PS_SIZE]; … … 567 567 //R:UCSparse 568 568 case 0: 569 if(D_G){printf("\nDC:UCSparse\n");} //DEBUG569 //if(D_G){printf("\nDC:UCSparse\n");} //DEBUG 570 570 //bp->nonZeros=*(uint16_t*)(&inBuf[9]); 571 571 //bytePos=11; … … 592 592 bytePos+=8; 593 593 } 594 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG594 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 595 595 break; 596 596 //R:UCNonSparse 597 597 case 1: 598 if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG598 //if(D_G){printf("\nDC:UCNonSparse\n");} //DEBUG 599 599 //memcpy(&outBuf[p->bSize*8], &inBuf[9], p->bSize*8); 600 600 memcpy(data, &inBuf[1], p->bSize*8); 601 601 bytePos=p->bSize*8; 602 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG602 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 603 603 break; 604 604 //R:CSparse 605 605 case 2: 606 if(D_G){printf("\nDC:CSparse\n");} //DEBUG606 //if(D_G){printf("\nDC:CSparse\n");} //DEBUG 607 607 //for(j=0;j<p->bSize;j++){ 608 608 // data[j]=0; … … 615 615 bp->ECQBits=inBuf[6]; 616 616 617 if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG617 //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 618 618 619 619 //bp->numOutliers=*(uint16_t*)(&inBuf[15]); … … 621 621 bp->numOutliers=*(uint16_t*)(&inBuf[7]); 622 622 bitPos=9*8; 623 if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG623 //if(D_R){printf("bp->numOutliers:%d\n",bp->numOutliers);} //DEBUG 624 624 625 625 bp->scalesBinSize=1/(float)(((uint64_t)1<<(bp->patternBits-1))-1); … … 627 627 bp->binSize=p->usedEb*2; 628 628 629 if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG629 //if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG 630 630 631 631 for(j=0;j<p->sbSize;j++){ 632 632 patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 633 if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}633 //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 634 634 } 635 635 for(j=0;j<p->sbNum;j++){ 636 636 scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 637 if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}637 //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 638 638 } 639 639 … … 649 649 case 2: 650 650 for(j=0;j<bp->numOutliers;j++){ 651 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG652 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG651 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 652 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 653 653 654 654 _1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 655 655 ECQTemp=readBits_I64(inBuf,&bitPos,1); 656 656 ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 657 // if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);657 ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 658 658 //continue; 659 659 //sb=_1DIdx/p->sbSize; … … 663 663 ECQ[_1DIdx]=ECQTemp; 664 664 665 // if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG665 ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 666 666 } 667 667 break; 668 668 default: //bp->ECQBits>2 669 if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: bp->ECQBits:%d bp->numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG669 //if(D_C){if(!((bp->ECQBits>=2)||((bp->ECQBits==1) && (bp->numOutliers==0)))){printf("ERROR: bp->ECQBits:%d bp->numOutliers:%d This should not have happened!\n",bp->ECQBits,bp->numOutliers);assert(0);}} //DEBUG 670 670 671 671 for(j=0;j<bp->numOutliers;j++){ … … 674 674 //localIdx=_1DIdx%p->sbSize; 675 675 temp=readBits_UI64(inBuf,&bitPos,1); 676 // if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG676 ////if(DEBUG){printf("temp:%ld\n",temp);} //DEBUG 677 677 switch(temp){ 678 678 case 0: //+-1 679 679 ECQTemp=readBits_I64(inBuf,&bitPos,1); 680 680 ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 681 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG682 // if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);681 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 682 ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 683 683 break; 684 684 case 1: //Others 685 685 ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 686 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG687 // if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp);686 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 687 ////if(D_R)printf("R:ECQ[%d]: %ld \n",_1DIdx,ECQTemp); 688 688 break; 689 689 //default: 690 // printf("ERROR: Bad 2-bit value: 0x%lx",temp);690 //// printf("ERROR: Bad 2-bit value: 0x%lx",temp); 691 691 // assert(0); //AMG 692 692 // break; … … 696 696 ECQ[_1DIdx]=ECQTemp; 697 697 698 // if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG698 ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 699 699 } 700 700 break; … … 705 705 706 706 bytePos=(bitPos+7)/8; 707 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG707 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 708 708 709 709 //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) … … 713 713 //R:CNonSparse 714 714 case 3: 715 if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG715 //if(D_G){printf("\nDC:CNonSparse\n");} //DEBUG 716 716 717 717 //for(j=0;j<p->bSize;j++){ … … 725 725 bp->ECQBits=inBuf[6]; 726 726 727 if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG727 //if(D_R){printf("bp->patternBits:%d bp->ECQBits:%d bp->_1DIdxBits:%d\n",bp->patternBits,bp->ECQBits,bp->_1DIdxBits);} //DEBUG 728 728 729 729 //bitPos=15*8; … … 733 733 bp->binSize=p->usedEb*2; 734 734 735 if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG735 //if(D_R){printf("bp->scalesBinSize:%.6e bp->binSize:%.6e bp->scalesBinSize*bp->binSize:%.6e\n",bp->scalesBinSize,bp->binSize,bp->scalesBinSize*bp->binSize);} //DEBUG 736 736 737 737 for(j=0;j<p->sbSize;j++){ 738 738 patternQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Pattern point 739 if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);}739 //if(D_R){printf("R:patternQ[%d]=%ld\n",j,patternQ[j]);} 740 740 } 741 741 for(j=0;j<p->sbNum;j++){ 742 742 scalesQ[j]=readBits_I64(inBuf,&bitPos,bp->patternBits);//Scale 743 if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);}743 //if(D_R){printf("R:scalesQ[%d]=%ld\n",j,scalesQ[j]);} 744 744 } 745 745 /* //Splitting 746 746 for(j=0;j<p->bSize;j++){ 747 747 data[j]=scalesQ[j/p->sbSize]*patternQ[j%p->sbSize]*bp->scalesBinSize*bp->binSize; 748 // if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);}748 ////if(DEBUG){printf("DC:PS[%d]=%.6e\n",j,data[j]);} 749 749 } 750 750 */ … … 752 752 case 2: 753 753 for(j=0;j<p->bSize;j++){ 754 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG755 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG754 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 755 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 756 756 //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 757 757 temp=readBits_UI64(inBuf,&bitPos,1); … … 769 769 } 770 770 771 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG771 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 772 772 //continue; 773 773 //sb=_1DIdx/p->sbSize; … … 777 777 ECQ[j]=ECQTemp; 778 778 779 // if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG779 ////if(DEBUG){printf("decompressed[%d]:%.6e\n",_1DIdx,data[_1DIdx]);} //DEBUG 780 780 } 781 781 break; 782 782 default: //bp->ECQBits>2 783 // if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos);783 ////if(DEBUG)printf("AMG_R1:bitPos: %ld\n",bitPos); 784 784 785 785 for(j=0;j<p->bSize;j++){ 786 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG787 // if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos);788 789 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG790 // if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG786 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 787 ////if(DEBUG)printf("AMG_R2:bitPos: %ld\n",bitPos); 788 789 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits));} //DEBUG 790 ////if(DEBUG){printf("readBits_UI64:%ld\n",readBits_I64(inBuf,&bitPos,2));} //DEBUG 791 791 //_1DIdx=readBits_UI64(inBuf,&bitPos,bp->_1DIdxBits); 792 792 temp=readBits_UI64(inBuf,&bitPos,1); 793 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG793 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 794 794 switch(temp){ 795 795 case 0: 796 // if(DEBUG)printf("Read:0");796 ////if(DEBUG)printf("Read:0"); 797 797 temp2=readBits_UI64(inBuf,&bitPos,1); 798 798 switch(temp2){ 799 799 case 0: 800 // if(DEBUG)printf("0");800 ////if(DEBUG)printf("0"); 801 801 ECQTemp=readBits_I64(inBuf,&bitPos,1); 802 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG803 // if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp);802 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 803 ////if(DEBUG)printf("R:ECQTemp:%ld\n",ECQTemp); 804 804 ECQTemp= ((ECQTemp<<63)>>63)|(uint64_t)0x1; 805 // if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);805 ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 806 806 break; 807 807 case 1: 808 // if(DEBUG)printf("1\n");808 ////if(DEBUG)printf("1\n"); 809 809 ECQTemp=readBits_I64(inBuf,&bitPos,bp->ECQBits); 810 // if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG811 // if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);810 ////if(DEBUG){printf("AMG_R3:bitPos:%ld buffer[%ld]=0x%lx\n",bitPos,bitPos/8,*(uint64_t*)(&inBuf[bitPos/8]));}; //DEBUG 811 ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 812 812 break; 813 813 default: … … 817 817 break; 818 818 case 1: 819 // if(DEBUG)printf("Read:1\n");819 ////if(DEBUG)printf("Read:1\n"); 820 820 ECQTemp=0; 821 // if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp);821 ////if(DEBUG)printf("R:ECQ[%d]: %ld\n",j,ECQTemp); 822 822 break; 823 823 default: … … 826 826 } 827 827 828 // if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG828 ////if(DEBUG){printf("_1DIdx:%ld ECQTemp:0x%ld\n",_1DIdx,ECQTemp);} //DEBUG 829 829 //continue; 830 830 //sb=_1DIdx/p->sbSize; … … 834 834 ECQ[j]=ECQTemp; 835 835 836 // if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG836 ////if(DEBUG){printf("DC:data[%d]:%.6e\n",j,data[j]);} //DEBUG 837 837 } 838 838 break; … … 842 842 //scalesQ=(int64_t*)(inBuf+15+p->sbSize*8); 843 843 bytePos=(bitPos+7)/8; 844 if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG844 //if(D_G){printf("\nDC:bytePos:%ld\n",bytePos);} //DEBUG 845 845 846 846 //STEP 2: PREDICT DATA(Includes INVERSE QUANTIZATION) … … 880 880 for(i=0;i<p->bSize;i++){ 881 881 if(idx0[i]!=idx0_dc[i]){ 882 printf("idx0[%d]=%d != %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i);882 //printf("idx0[%d]=%d != %d=idx0_dc[%d]",i,idx0[i],idx0_dc[i],i); 883 883 assert(0); 884 884 } 885 885 if(idx1[i]!=idx1_dc[i]){ 886 printf("idx1[%d]=%d != %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i);886 //printf("idx1[%d]=%d != %d=idx1_dc[%d]",i,idx1[i],idx1_dc[i],i); 887 887 assert(0); 888 888 } 889 889 if(idx2[i]!=idx2_dc[i]){ 890 printf("idx2[%d]=%d != %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i);890 //printf("idx2[%d]=%d != %d=idx2_dc[%d]",i,idx2[i],idx2_dc[i],i); 891 891 assert(0); 892 892 } 893 893 if(idx3[i]!=idx3_dc[i]){ 894 printf("idx3[%d]=%d != %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i);894 //printf("idx3[%d]=%d != %d=idx3_dc[%d]",i,idx3[i],idx3_dc[i],i); 895 895 assert(0); 896 896 } … … 901 901 for(i=0;i<p->bSize;i++){ 902 902 if(abs_FastD(data[i]-data_dc[i])>p->usedEb){ 903 printf("|data[%d]-data_dc[%d]|>originalEb : %.3e - %.3e = %.3e > %.3e\n",i,i,data[i],data_dc[i],abs_FastD(data[i]-data_dc[i]),p->usedEb);903 //printf("|data[%d]-data_dc[%d]|>originalEb : %.3e - %.3e = %.3e > %.3e\n",i,i,data[i],data_dc[i],abs_FastD(data[i]-data_dc[i]),p->usedEb); 904 904 assert(0); 905 905 } -
thirdparty/SZ/sz/include/sz.h
r2c47b73 r9ee2ce3 55 55 #include "sz_float_ts.h" 56 56 #include "szd_float_ts.h" 57 #include "utility.h" 57 58 58 59 #ifdef _WIN32 … … 75 76 //typedef unsigned long uint64_t; 76 77 77 #define SZ_VERNUM 0x0 14078 #define SZ_VER_MAJOR 179 #define SZ_VER_MINOR 480 #define SZ_VER_BUILD 1381 #define SZ_VER_REVISION 578 #define SZ_VERNUM 0x0200 79 #define SZ_VER_MAJOR 2 80 #define SZ_VER_MINOR 0 81 #define SZ_VER_BUILD 2 82 #define SZ_VER_REVISION 0 82 83 83 84 #define PASTRI 103 … … 131 132 #define SZ_TEMPORAL_COMPRESSION 3 132 133 134 #define SZ_NO_REGRESSION 0 135 #define SZ_WITH_LINEAR_REGRESSION 1 136 133 137 #define SZ_PWR_MIN_TYPE 0 134 138 #define SZ_PWR_AVG_TYPE 1 … … 152 156 153 157 #define numOfBufferedSteps 1 //the number of time steps in the buffer 158 159 160 #define GZIP_COMPRESSOR 0 //i.e., ZLIB_COMPRSSOR 161 #define ZSTD_COMPRESSOR 1 154 162 155 163 //Note: the following setting should be consistent with stateNum in Huffman.h … … 237 245 unsigned int maxRangeRadius; 238 246 int sol_ID;// it's always SZ, unless the setting is PASTRI compression mode (./configure --enable-pastri) 247 int losslessCompressor; 239 248 int sampleDistance; //2 bytes 240 249 float predThreshold; // 2 bytes … … 279 288 char metadata_filename[256]; 280 289 FILE *metadata_file; 290 unsigned char* bit_array; //sihuan added 291 size_t intersect_size; //sihuan added 292 int64_t* hist_index; //sihuan added: prestep index 293 281 294 } sz_tsc_metadata; 282 295 … … 290 303 extern sz_params *confparams_dec; 291 304 extern sz_exedata *exe_params; 305 extern int sz_with_regression; 306 292 307 //------------------------------------------------ 293 308 extern SZ_VarSet* sz_varset; … … 357 372 size_t compute_total_batch_size(); 358 373 359 int isZlibFormat(unsigned char magic1, unsigned char magic2);360 361 374 void SZ_registerVar(char* varName, int dataType, void* data, 362 375 int errBoundMode, double absErrBound, double relBoundRatio, double pwRelBoundRatio, -
thirdparty/SZ/sz/include/sz_double.h
r2c47b73 r9ee2ce3 76 76 size_t r1, size_t r2, size_t r3, size_t r4, size_t s1, size_t s2, size_t s3, size_t s4, size_t e1, size_t e2, size_t e3, size_t e4); 77 77 78 unsigned int optimize_intervals_double_2D_with_freq_and_dense_pos(double *oriData, size_t r1, size_t r2, double realPrecision, double * dense_pos, double * max_freq, double * mean_freq); 79 unsigned int optimize_intervals_double_3D_with_freq_and_dense_pos(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, double * dense_pos, double * max_freq, double * mean_freq); 80 unsigned char * SZ_compress_double_2D_MDQ_nonblocked_with_blocked_regression(double *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size); 81 unsigned char * SZ_compress_double_3D_MDQ_nonblocked_with_blocked_regression(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size); 82 83 78 84 #ifdef __cplusplus 79 85 } -
thirdparty/SZ/sz/include/sz_double_pwr.h
r2c47b73 r9ee2ce3 38 38 size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f, size_t *outSize); 39 39 40 void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, double *oriData, double globalPrecision, size_t dataLength, size_t *outSize, double min, double max); 41 void SZ_compress_args_double_NoCkRngeNoGzip_2D_pwr_pre_log(unsigned char** newByteData, double *oriData, double globalPrecision, size_t r1, size_t r2, size_t *outSize, double min, double max); 42 void SZ_compress_args_double_NoCkRngeNoGzip_3D_pwr_pre_log(unsigned char** newByteData, double *oriData, double globalPrecision, size_t r1, size_t r2, size_t r3, size_t *outSize, double min, double max); 43 40 44 #ifdef __cplusplus 41 45 } -
thirdparty/SZ/sz/include/sz_float.h
r2c47b73 r9ee2ce3 129 129 size_t r1, size_t r2, size_t r3, size_t r4, size_t s1, size_t s2, size_t s3, size_t s4, size_t e1, size_t e2, size_t e3, size_t e4); 130 130 131 132 unsigned int optimize_intervals_float_2D_with_freq_and_dense_pos(float *oriData, size_t r1, size_t r2, double realPrecision, float * dense_pos, float * max_freq, float * mean_freq); 133 unsigned int optimize_intervals_float_3D_with_freq_and_dense_pos(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, float * dense_pos, float * max_freq, float * mean_freq); 134 135 unsigned char * SZ_compress_float_2D_MDQ_nonblocked_with_blocked_regression(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size); 136 unsigned char * SZ_compress_float_3D_MDQ_nonblocked_with_blocked_regression(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size); 137 unsigned char * SZ_compress_float_3D_MDQ_random_access_with_blocked_regression(float *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size); 138 131 139 #ifdef __cplusplus 132 140 } -
thirdparty/SZ/sz/include/sz_float_pwr.h
r2c47b73 r9ee2ce3 45 45 size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f, size_t *outSize); 46 46 47 void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float min, float max); 48 void SZ_compress_args_float_NoCkRngeNoGzip_2D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t r1, size_t r2, size_t *outSize, float min, float max); 49 void SZ_compress_args_float_NoCkRngeNoGzip_3D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t r1, size_t r2, size_t r3, size_t *outSize, float min, float max); 50 47 51 #ifdef __cplusplus 48 52 } -
thirdparty/SZ/sz/include/szd_double.h
r2c47b73 r9ee2ce3 25 25 void getSnapshotData_double_3D(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps, int errBoundMode); 26 26 void getSnapshotData_double_4D(double** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageD* tdps, int errBoundMode); 27 void decompressDataSeries_double_2D_nonblocked_with_blocked_regression(double** data, size_t r1, size_t r2, unsigned char* comp_data); 28 void decompressDataSeries_double_3D_nonblocked_with_blocked_regression(double** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data); 27 29 28 30 int SZ_decompress_args_double(double** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize); -
thirdparty/SZ/sz/include/szd_double_pwr.h
r2c47b73 r9ee2ce3 22 22 23 23 void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps); 24 void decompressDataSeries_double_1D_pwr_pre_log(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps); 25 void decompressDataSeries_double_2D_pwr_pre_log(double** data, size_t r1, size_t r2, TightDataPointStorageD* tdps); 26 void decompressDataSeries_double_3D_pwr_pre_log(double** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageD* tdps); 27 24 28 #ifdef __cplusplus 25 29 } -
thirdparty/SZ/sz/include/szd_float.h
r2c47b73 r9ee2ce3 32 32 33 33 size_t decompressDataSeries_float_3D_RA_block(float * data, float mean, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, double realPrecision, int * type, float * unpredictable_data); 34 35 void decompressDataSeries_float_2D_nonblocked_with_blocked_regression(float** data, size_t r1, size_t r2, unsigned char* comp_data); 36 void decompressDataSeries_float_3D_nonblocked_with_blocked_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data); 37 void decompressDataSeries_float_3D_random_access_with_blocked_regression(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data); 38 34 39 #ifdef __cplusplus 35 40 } -
thirdparty/SZ/sz/include/szd_float_pwr.h
r2c47b73 r9ee2ce3 23 23 char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength); 24 24 void decompressDataSeries_float_1D_pwrgroup(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps); 25 void decompressDataSeries_float_1D_pwr_pre_log(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps); 26 void decompressDataSeries_float_2D_pwr_pre_log(float** data, size_t r1, size_t r2, TightDataPointStorageF* tdps); 27 void decompressDataSeries_float_3D_pwr_pre_log(float** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageF* tdps); 25 28 26 29 #ifdef __cplusplus
Note: See TracChangeset
for help on using the changeset viewer.