Commit 8933935fbd29c82f62ea26947e6b271e0c3e61f1
1 parent
0a575bb1
updated VERBOSE information for optimization
Showing
2 changed files
with
5 additions
and
5 deletions
Show diff stats
stim/envi/binary.h
@@ -54,7 +54,7 @@ protected: | @@ -54,7 +54,7 @@ protected: | ||
54 | public: | 54 | public: |
55 | 55 | ||
56 | //constructor initializes a stream optimizer | 56 | //constructor initializes a stream optimizer |
57 | - stream_optimizer(size_t min_batch_size, size_t max_batch_size, double a = 0.0001, size_t window = 1000){ | 57 | + stream_optimizer(size_t min_batch_size, size_t max_batch_size, double a = 0.001, double probe_step = 5, size_t window = 2000){ |
58 | //Bps = 0; //initialize to zero bytes per second processed | 58 | //Bps = 0; //initialize to zero bytes per second processed |
59 | Bps[0] = Bps[1] = 0; //initialize the bits per second to 0 | 59 | Bps[0] = Bps[1] = 0; //initialize the bits per second to 0 |
60 | interval_B = 0; //zero bytes have been processed at initialization | 60 | interval_B = 0; //zero bytes have been processed at initialization |
@@ -62,7 +62,7 @@ public: | @@ -62,7 +62,7 @@ public: | ||
62 | dn = min_batch_size; //set the minimum batch size as the minimum change in batch size | 62 | dn = min_batch_size; //set the minimum batch size as the minimum change in batch size |
63 | maxn = max_batch_size; //set the maximum batch size | 63 | maxn = max_batch_size; //set the maximum batch size |
64 | n[0] = max_batch_size; //set B | 64 | n[0] = max_batch_size; //set B |
65 | - h = (max_batch_size / min_batch_size) / 10 * dn; | 65 | + h = (max_batch_size / min_batch_size) / probe_step * dn; |
66 | std::cout<<"h = "<<h<<std::endl; | 66 | std::cout<<"h = "<<h<<std::endl; |
67 | if(h < dn) h = dn; | 67 | if(h < dn) h = dn; |
68 | alpha = a; | 68 | alpha = a; |
stim/envi/bsq.h
@@ -400,7 +400,7 @@ public: | @@ -400,7 +400,7 @@ public: | ||
400 | 400 | ||
401 | if(VERBOSE){ | 401 | if(VERBOSE){ |
402 | std::cout<<"maximum memory available for processing: "<<(double)binary<T>::buffer_size/(double)1000000<<" MB"<<std::endl; | 402 | std::cout<<"maximum memory available for processing: "<<(double)binary<T>::buffer_size/(double)1000000<<" MB"<<std::endl; |
403 | - std::cout<<" this supports a batch size of "<<max_slices_per_batch<<" Y-axis slices"<<std::endl; | 403 | + std::cout<<" this supports a batch size of "<<max_slices_per_batch<<" Y-axis slices ("<<X()<<" x "<<Z()<<")"<<std::endl; |
404 | } | 404 | } |
405 | 405 | ||
406 | if(max_slices_per_batch == 0){ //if there is insufficient memory for a single slice, throw an error | 406 | if(max_slices_per_batch == 0){ //if there is insufficient memory for a single slice, throw an error |
@@ -449,7 +449,7 @@ public: | @@ -449,7 +449,7 @@ public: | ||
449 | //} | 449 | //} |
450 | if(y_load + N[b] > Y()) N[b] = Y() - y_load; //if the next batch would process more than the total slices, adjust the batch size | 450 | if(y_load + N[b] > Y()) N[b] = Y() - y_load; //if the next batch would process more than the total slices, adjust the batch size |
451 | rthread = std::async(std::launch::async, &stim::bsq<T>::readlines, this, src[b], y_load, N[b]); | 451 | rthread = std::async(std::launch::async, &stim::bsq<T>::readlines, this, src[b], y_load, N[b]); |
452 | - rt_total += rthread.get(); | 452 | + //rt_total += rthread.get(); |
453 | y_load += N[b]; //increment the number of loaded slices | 453 | y_load += N[b]; //increment the number of loaded slices |
454 | } | 454 | } |
455 | 455 | ||
@@ -461,7 +461,7 @@ public: | @@ -461,7 +461,7 @@ public: | ||
461 | t_end = std::chrono::high_resolution_clock::now(); | 461 | t_end = std::chrono::high_resolution_clock::now(); |
462 | t_batch = std::chrono::duration_cast<std::chrono::milliseconds>(t_end-t_start).count(); | 462 | t_batch = std::chrono::duration_cast<std::chrono::milliseconds>(t_end-t_start).count(); |
463 | t_total += t_batch; | 463 | t_total += t_batch; |
464 | - //if(y_load < Y()) rt_total += rthread.get(); //if a new batch was set to load, make sure it loads after calculations | 464 | + if(y_load < Y()) rt_total += rthread.get(); //if a new batch was set to load, make sure it loads after calculations |
465 | N[b] = O.update(N[!b] * slice_bytes, t_batch, data_rate); //set the batch size based on optimization | 465 | N[b] = O.update(N[!b] * slice_bytes, t_batch, data_rate); //set the batch size based on optimization |
466 | //std::cout<<"New N = "<<N[!b]<<" selected with "<<(double)data_rate / 1000000<<" MB/s"<<std::endl; | 466 | //std::cout<<"New N = "<<N[!b]<<" selected with "<<(double)data_rate / 1000000<<" MB/s"<<std::endl; |
467 | } | 467 | } |