|
@@ -1,10 +1,8 @@
|
|
-// We really want points to be capital letters and scalars to be
|
|
|
|
-// lowercase letters
|
|
|
|
-#![allow(non_snake_case)]
|
|
|
|
-
|
|
|
|
use std::env;
|
|
use std::env;
|
|
use std::time::Instant;
|
|
use std::time::Instant;
|
|
|
|
|
|
|
|
+use rand::RngCore;
|
|
|
|
+
|
|
use spiral_spir::client::Client;
|
|
use spiral_spir::client::Client;
|
|
use spiral_spir::init;
|
|
use spiral_spir::init;
|
|
use spiral_spir::server::Server;
|
|
use spiral_spir::server::Server;
|
|
@@ -21,7 +19,7 @@ fn main() {
|
|
let r: usize = args[1].parse().unwrap();
|
|
let r: usize = args[1].parse().unwrap();
|
|
let mut num_threads = 1usize;
|
|
let mut num_threads = 1usize;
|
|
let mut num_preproc = 1usize;
|
|
let mut num_preproc = 1usize;
|
|
- let mut num_pirs = 1usize;
|
|
|
|
|
|
+ let num_pirs: usize;
|
|
if args.len() > 2 {
|
|
if args.len() > 2 {
|
|
num_threads = args[2].parse().unwrap();
|
|
num_threads = args[2].parse().unwrap();
|
|
}
|
|
}
|
|
@@ -34,6 +32,7 @@ fn main() {
|
|
num_pirs = num_preproc;
|
|
num_pirs = num_preproc;
|
|
}
|
|
}
|
|
let num_records = 1 << r;
|
|
let num_records = 1 << r;
|
|
|
|
+ let num_records_mask = num_records - 1;
|
|
|
|
|
|
println!("===== ONE-TIME SETUP =====\n");
|
|
println!("===== ONE-TIME SETUP =====\n");
|
|
|
|
|
|
@@ -64,7 +63,7 @@ fn main() {
|
|
let preproc_server_us = preproc_server_start.elapsed().as_micros();
|
|
let preproc_server_us = preproc_server_start.elapsed().as_micros();
|
|
|
|
|
|
println!("Preprocessing server: {} µs", preproc_server_us);
|
|
println!("Preprocessing server: {} µs", preproc_server_us);
|
|
- println!("preproc_response len = {}", preproc_resp.len());
|
|
|
|
|
|
+ println!("preproc_resp len = {}", preproc_resp.len());
|
|
|
|
|
|
let preproc_finish_start = Instant::now();
|
|
let preproc_finish_start = Instant::now();
|
|
client.preproc_finish(&preproc_resp);
|
|
client.preproc_finish(&preproc_resp);
|
|
@@ -72,6 +71,19 @@ fn main() {
|
|
|
|
|
|
println!("Preprocessing client finish: {} µs", preproc_finish_us);
|
|
println!("Preprocessing client finish: {} µs", preproc_finish_us);
|
|
|
|
|
|
|
|
+ let mut rng = rand::thread_rng();
|
|
|
|
+ for i in 1..num_pirs + 1 {
|
|
|
|
+ println!("\n===== SPIR QUERY {} =====\n", i);
|
|
|
|
+
|
|
|
|
+ let idx = (rng.next_u64() as usize) & num_records_mask;
|
|
|
|
+ let query_client_start = Instant::now();
|
|
|
|
+ let query_msg = client.query(idx);
|
|
|
|
+ let query_client_us = query_client_start.elapsed().as_micros();
|
|
|
|
+
|
|
|
|
+ println!("Query client: {} µs", query_client_us);
|
|
|
|
+ println!("query_msg len = {}", query_msg.len());
|
|
|
|
+ }
|
|
|
|
+
|
|
/*
|
|
/*
|
|
let spiral_params = params::get_spiral_params(r);
|
|
let spiral_params = params::get_spiral_params(r);
|
|
let mut rng = rand::thread_rng();
|
|
let mut rng = rand::thread_rng();
|