Ian Goldberg 1 year ago
parent
commit
74b74f4649
2 changed files with 26 additions and 9 deletions
  1. 4 2
      Docker/run-experiment.sh
  2. 22 7
      cpir-read/cxx/spir_test.cpp

+ 4 - 2
Docker/run-experiment.sh

@@ -102,10 +102,12 @@ date "+===== Start %s %F %T"
         # Run, saving the output
         savefilep0=$$.p0.out
         savefilep1=$$.p1.out
-        docker exec -w /root/duoram/cpir-read/cxx duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0  ./spir_test1  $p0addr $size $iters $iters $iters > $savefilep1 2>&1" &
+        nproc0=$(docker exec -w /root/duoram/cpir-read/cxx duoram_p0 bash -c "$DUORAM_NUMA_P0 nproc 2>/dev/null")
+        nproc1=$(docker exec -w /root/duoram/cpir-read/cxx duoram_p1 bash -c "$DUORAM_NUMA_P1 nproc 2>/dev/null")
+        docker exec -w /root/duoram/cpir-read/cxx duoram_p1 bash -c "$DUORAM_NUMA_P1 stdbuf -o 0  ./spir_test1  $p0addr $size $nproc1 $iters $iters > $savefilep1 2>&1" &
         echo "P1 launched"
         sleep 4
-        docker exec -w /root/duoram/cpir-read/cxx duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0  ./spir_test0  $p1addr $size $iters $iters $iters > $savefilep0 2>&1" &
+        docker exec -w /root/duoram/cpir-read/cxx duoram_p0 bash -c "$DUORAM_NUMA_P0 stdbuf -o 0  ./spir_test0  $p1addr $size $nproc0 $iters $iters > $savefilep0 2>&1" &
         echo "P0 launched"
         wait
         echo ===== P0 output

+ 22 - 7
cpir-read/cxx/spir_test.cpp

@@ -159,6 +159,7 @@ int main(int argc, char **argv)
     struct timeval otsetup_start;
     gettimeofday(&otsetup_start, NULL);
 
+    cout << "num_threads = " << num_threads << "\n";
     SPIR::init(num_threads);
 
     string pub_params, pub_params_recv;
@@ -216,6 +217,10 @@ int main(int argc, char **argv)
     size_t preproc_finish_us = elapsed_us(&preproc_finish_start);
     cout << "Preprocessing client finish: " << preproc_finish_us << " µs\n";
 
+    size_t preproc_total_us = elapsed_us(&preproc_client_start);
+    cout << "\n\nTotal preprocessing time: " << preproc_total_us << " µs\n";
+    cout << "Total preprocessing bytes: " << (preproc_msg.length() + preproc_resp.length()) << "\n";
+
     // Create the database
     SPIR::DBEntry *db = new SPIR::DBEntry[num_records];
     for (size_t i=0; i<num_records; ++i) {
@@ -232,7 +237,11 @@ int main(int argc, char **argv)
     size_t tot_query_bytes = 0;
 
     for (size_t i=0; i<num_pirs; ++i) {
-        cout << "\n===== SPIR QUERY " << i+1 << " =====\n\n";
+        if (i < 2 || i == num_pirs-1) {
+            cout << "\n===== SPIR QUERY " << i+1 << " =====\n\n";
+        } else if (i == 2) {
+            cout << "\n...\n\n";
+        }
 
         size_t idx;
         if (getrandom(&idx, sizeof(idx), 0) != sizeof(idx)) {
@@ -268,8 +277,10 @@ int main(int argc, char **argv)
 
 
         size_t query_client_us = elapsed_us(&query_client_start);
-        cout << "Query client: " << query_client_us << " µs\n";
-        cout << "query_msg len = " << query_msg.length() << "\n";
+        if (i < 2 || i == num_pirs-1) {
+            cout << "Query client: " << query_client_us << " µs\n";
+            cout << "query_msg len = " << query_msg.length() << "\n";
+        }
 
         struct timeval query_server_start;
         gettimeofday(&query_server_start, NULL);
@@ -282,8 +293,10 @@ int main(int argc, char **argv)
         boost::asio::read(sockets_[0], boost::asio::buffer(query_resp_recv));
 
         size_t query_server_us = elapsed_us(&query_server_start);
-        cout << "Query server: " << query_server_us << " µs\n";
-        cout << "query_resp len = " << query_resp.length() << "\n";
+        if (i < 2 || i == num_pirs-1) {
+            cout << "Query server: " << query_server_us << " µs\n";
+            cout << "query_resp len = " << query_resp.length() << "\n";
+        }
 
         struct timeval query_finish_start;
         gettimeofday(&query_finish_start, NULL);
@@ -308,8 +321,10 @@ int main(int argc, char **argv)
 
 
         size_t query_finish_us = elapsed_us(&query_finish_start);
-        cout << "Query client finish: " << query_finish_us << " µs\n";
-        cout << "idx = " << idx << "; entry = " << entry << "\n";
+        if (i < 2 || i == num_pirs-1) {
+            cout << "Query client finish: " << query_finish_us << " µs\n";
+            cout << "idx = " << idx << "; entry = " << entry << "\n";
+        }
      }
     size_t all_queries_us = elapsed_us(&all_queries_start);
     cout << "\n\nTotal query time: " << all_queries_us << " µs\n";