Browse Source

making args consitent with p0 p1

avadapal 2 years ago
parent
commit
3643025674
1 changed files with 16 additions and 4 deletions
  1. 16 4
      preprocessing/p2preprocessing.cpp

+ 16 - 4
preprocessing/p2preprocessing.cpp

@@ -82,7 +82,8 @@ int main(int argc, char* argv[])
  const size_t n_threads = atoi(argv[3]);
  const size_t number_of_sockets = 5 * n_threads;
  const size_t db_nitems = 1ULL << atoi(argv[4]);
- const size_t maxRAM = atoi(argv[5]);
+ const size_t op = atoi(argv[5]);
+ const size_t maxRAM = atoi(argv[6]);
 
  std::cout << "maxRAM = "  << maxRAM << std::endl;
  size_t RAM_needed = 0;
@@ -195,7 +196,7 @@ int main(int argc, char* argv[])
 
 
  
-  boost::asio::thread_pool pool(thread_per_batch);  
+ 
 
   boost::asio::write(sockets0[0], boost::asio::buffer(&computecw0_array,  sizeof(computecw0_array)));
   boost::asio::write(sockets1[0], boost::asio::buffer(&computecw1_array,  sizeof(computecw1_array)));
@@ -203,15 +204,26 @@ int main(int argc, char* argv[])
   boost::asio::read(sockets0[0], boost::asio::buffer(dpf_instance0, n_threads * sizeof(dpfP2)));
   boost::asio::read(sockets1[0], boost::asio::buffer(dpf_instance1, n_threads * sizeof(dpfP2))); 
 
-
+  boost::asio::thread_pool pool(thread_per_batch); 
     for(size_t j = 0; j < thread_per_batch; ++j)
     {
      boost::asio::post(pool, std::bind(mpc_gen,  std::ref(depth), std::ref(aeskey), db_nitems, n_threads,  std::ref(sockets0), std::ref(sockets1), 
                                      output0, flags0,  output1, flags1,  std::ref(dpf_instance0), std::ref(dpf_instance1), j, 5 * j));    
     }  
 
-  pool.join();
+ pool.join();
  
+ if(op == 1)
+ {
+    boost::asio::thread_pool pool(thread_per_batch); 
+    for(size_t j = 0; j < thread_per_batch; ++j)
+    {
+     boost::asio::post(pool, std::bind(mpc_gen,  std::ref(depth), std::ref(aeskey), db_nitems, n_threads,  std::ref(sockets0), std::ref(sockets1), 
+                                     output0, flags0,  output1, flags1,  std::ref(dpf_instance0), std::ref(dpf_instance1), j, 5 * j));    
+    }  
+
+   pool.join();
+ }