Skip to content

Commit

Permalink
remove chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Weilei Zeng committed Apr 15, 2020
1 parent 28a1425 commit b34b029
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
14 changes: 14 additions & 0 deletions gnuplot/result/my-bp5-test.gnudat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# header
# sizes: 13, 9, 5,
# p, P_c converge rate, counts_total, counts_nonconverge, timer.toc()
0.199526 0.000000 107.000000 107.000000 8.693991 0.199526 0.000000 107.000000 107.000000 2.091622 0.199526 0.230216 139.000000 107.000000 0.256222
0.158489 0.000000 107.000000 107.000000 8.855936 0.158489 0.009259 108.000000 107.000000 2.089882 0.158489 0.316129 155.000000 106.000000 0.240383
0.125893 0.000000 107.000000 107.000000 8.832254 0.125893 0.044643 112.000000 107.000000 2.143848 0.125893 0.286667 150.000000 107.000000 0.238226
0.100000 0.036036 111.000000 107.000000 8.979232 0.100000 0.053097 113.000000 107.000000 2.130170 0.100000 0.478049 205.000000 107.000000 0.245918
0.079433 0.061404 114.000000 107.000000 8.897053 0.079433 0.256944 144.000000 107.000000 2.188192 0.079433 0.602273 264.000000 105.000000 0.254901
0.063096 0.183206 131.000000 107.000000 9.184160 0.063096 0.401130 177.000000 106.000000 2.265145 0.063096 0.730479 397.000000 107.000000 0.264265
0.050119 0.314103 156.000000 107.000000 9.420049 0.050119 0.622776 281.000000 106.000000 2.438023 0.050119 0.847482 695.000000 106.000000 0.284545
0.039811 0.578740 254.000000 107.000000 10.339284 0.039811 0.722222 378.000000 105.000000 2.523526 0.039811 0.878301 871.000000 106.000000 0.294539
0.031623 0.715447 369.000000 105.000000 11.069835 0.031623 0.853964 719.000000 105.000000 2.900765 0.031623 0.917918 999.000000 82.000000 0.271430
0.025119 0.823024 582.000000 103.000000 11.870014 0.025119 0.883539 893.000000 104.000000 2.862727 0.025119 0.959880 997.000000 40.000000 0.167649
0.019953 0.883878 887.000000 103.000000 12.938705 0.019953 0.940000 1000.000000 60.000000 2.268555 0.019953 0.979899 995.000000 20.000000 0.118463
15 changes: 7 additions & 8 deletions my_bp5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main(int argc, char **argv){
timer.tic();
for ( double ip=ip_begin;ip > ip_end;ip-=0.1){
//cout<<"ip = "<<ip<<endl;
// row_index ++;
row_index ++;
//atof(argv[4]);
p=pow(10,ip);

Expand Down Expand Up @@ -122,7 +122,7 @@ int main(int argc, char **argv){
//pool.push_back(move(fut));
//pool.push_back(async(launch::async, decode, bp_decoder, G, H, p, & data,col_index, row_index, cycles, feedback, time_out, num_data_points) );
//pool.push_back(async(launch::async, decode, bp_decoder, G, H, p, & chunk_data,col_index, row_index, chunk_cycles, feedback, chunk_time_out, chunk_num_data_points) );
decode( bp_decoder, G, H, p, data,col_index, row_index, cycles, feedback, time_out, num_data_points);
decode( bp_decoder, G, H, p, & data,col_index, row_index, cycles, feedback, time_out, num_data_points);

//remained_time = timer.toc()/(row_index+1)*chunk_num_for_each_size;
std::cout
Expand All @@ -133,8 +133,7 @@ int main(int argc, char **argv){
<<", remained time for this p is "<< remained_time <<" sec"
<<", col_index = "<<col_index
//<<", chunk_cycles = "<<chunk_cycles
<<endl;
}
<<endl;
}
}
//finish adding all the threads and most of them are done
Expand All @@ -159,7 +158,7 @@ int main(int argc, char **argv){
}*/

//process chunk_data to data
int temp_index;
/*int temp_index;
double value;
for ( int i =0; i<data.rows();i++){
for ( int j = 0; j< data.cols();j++){
Expand All @@ -172,7 +171,7 @@ int main(int argc, char **argv){
data.set(i,j,value);
}
}

*/
//print final result
mat2gnudata(data,filename_data,header);
cout<<"save final data to "<<filename_data.c_str()<<endl;
Expand Down Expand Up @@ -206,7 +205,7 @@ int decode( BP_Decoder bp_decoder, GF2mat G, GF2mat H, double p, mat * data, in

int counts_converge=0;
int counts_nonconverge=0;
#pragma omp parallel for num_threads(8)
#pragma omp parallel for num_threads(18)
for (int i=0;i<cycles;i++){
if ( counts_nonconverge < num_data_points){
vec LLRin(nvar);
Expand Down Expand Up @@ -256,7 +255,7 @@ int decode( BP_Decoder bp_decoder, GF2mat G, GF2mat H, double p, mat * data, in
counts_converge++;
}else{
counts_nonconverge++;
std::cout<<"counts_nonconverge = "<<counts_nonconverge<<std::endl;
//std::cout<<"counts_nonconverge = "<<counts_nonconverge<<std::endl;

/*
//time control
Expand Down

0 comments on commit b34b029

Please sign in to comment.