static void sampling_apply(const linop_data_t* _data, complex float* dst, const complex float* src) { const auto data = CAST_DOWN(sampling_data_s, _data); #ifdef USE_CUDA const complex float* pattern = get_pat(data, cuda_ondevice(src)); #else const complex float* pattern = data->pattern; #endif md_zmul2(DIMS, data->dims, data->strs, dst, data->strs, src, data->pat_strs, pattern); }
int arop(int count, int op) { float32 f1, f2, f3, f4; int i; int fp; char *mode; int add=0; int sub=0; int mul=0; int div=0; int oper; int err; int err_count=0; if(!quiet) printf("\nGenerating %0d Arithmetic test vectors ...\n",count); if(append) mode = "a"; else mode = "w"; if(ofile==0) ofile = "ar.hex"; fp = fopen(ofile,mode); if(fp == 0) { printf("ERROR: Could not create file '%s'.\n",ofile); return(-1); } if(!quiet) { if(op & 0x1) printf("Add OP\n"); if(op & 0x2) printf("Sub OP\n"); if(op & 0x4) printf("Mul OP\n"); if(op & 0x8) printf("Div OP\n"); } if(op & 0x1) add=1; if(op & 0x2) sub=1; if(op & 0x4) mul=1; if(op & 0x8) div=1; f1 = get_pat(0); // Initialize pattern generator ... for(i=0;i<count;i++) { err = 0; if(pat>0) { f1 = get_pat(1); f2 = get_pat(2); } else { f1 = get_fp(); f2 = get_fp(); } if(rall) float_rounding_mode = (rand() % 4); oper = -1; while(oper == -1) { float_exception_flags = 0; // Reset Exceptions if( (rand() % 4)==3 & div) { oper = 8; f3 = float32_div( f1, f2); float_exception_flags = 0; // Reset Exceptions f3 = float32_div( f1, f2); //*( (float *) &f4 ) = *( (float *) &f1 ) / *( (float *) &f2 ); //if( f4 != f3) { // err = 1; // printf("FP Div Error: %x - %x: System: %x Lib: %x\n",f1, f2, f4, f3); // } } if( (rand() % 4)==2 & mul) { oper = 4; f3 = float32_mul( f1, f2); float_exception_flags = 0; // Reset Exceptions f3 = float32_mul( f1, f2); //*( (float *) &f4 ) = *( (float *) &f1 ) * *( (float *) &f2 ); //if( f4 != f3) { // err = 1; // printf("FP Mul Error: %x - %x: System: %x Lib: %x\n",f1, f2, f4, f3); // } } if( (rand() % 4)==1 & sub) { oper = 2; f3 = float32_sub( f1, f2); float_exception_flags = 0; // Reset Exceptions f3 = float32_sub( f1, f2); //*( (float *) &f4 ) = *( (float *) &f1 ) - *( (float *) &f2 ); //if( f4 != f3) { // err = 1; // printf("FP Sub Error: %x - %x: System: %x Lib: %x\n",f1, f2, f4, f3); // } } if( (rand() % 4)==0 & add) { oper = 1; f3 = float32_add( f1, f2); float_exception_flags = 0; // Reset Exceptions f3 = float32_add( f1, f2); //*( (float *) &f4 ) = *( (float *) &f1 ) + *( (float *) &f2 ); //if( f4 != f3) { // err = 1; // printf("FP Add Error: %x - %x: System: %x Lib: %x\n",f1, f2, f4, f3); // } } } if(err) err_count++; if(!err) { //if(float_exception_flags != 0) // printf("Exceptions: %x\n",float_exception_flags); if(verb) printf("rmode: %01x, except: %02x, oper: %01x opa: %08x, opb: %08x res: %08x\n", float_rounding_mode, float_exception_flags, oper, f1, f2, f3); fprintf(fp,"%01x%02x%01x%08x%08x%08x\n", float_rounding_mode, float_exception_flags, oper, f1, f2, f3); } else { printf("\t Vecor mismatch between library and system calculations. This Vector\n"); printf("\t will not be placed in to vector file ...\n"); } } close(fp); if(!quiet) { printf("Found %d errors\n",err_count); printf("Wrote %d vectors from total %d specified.\n", (count-err_count), count); printf("\n ... f2i done.\n"); } return(0); }
void get_4x4(int x, int y) { get_pat(0+(x*4),0+(y*4)); get_pat(0+(x*4),1+(y*4)); get_pat(0+(x*4),2+(y*4)); get_pat(0+(x*4),3+(y*4)); get_pat(1+(x*4),0+(y*4)); get_pat(1+(x*4),1+(y*4)); get_pat(1+(x*4),2+(y*4)); get_pat(1+(x*4),3+(y*4)); get_pat(2+(x*4),0+(y*4)); get_pat(2+(x*4),1+(y*4)); get_pat(2+(x*4),2+(y*4)); get_pat(2+(x*4),3+(y*4)); get_pat(3+(x*4),0+(y*4)); get_pat(3+(x*4),1+(y*4)); get_pat(3+(x*4),2+(y*4)); get_pat(3+(x*4),3+(y*4)); }
void get_2x2(int x) { get_pat(0+(x*2),0); get_pat(0+(x*2),1); get_pat(1+(x*2),0); get_pat(1+(x*2),1); }