|
@@ -1,6 +1,7 @@
|
|
|
#include <iostream>
|
|
|
#include <stdlib.h>
|
|
|
#include <sys/time.h>
|
|
|
+#include <unistd.h>
|
|
|
#include "spir.hpp"
|
|
|
|
|
|
using std::cout;
|
|
@@ -15,18 +16,23 @@ static inline size_t elapsed_us(const struct timeval *start)
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
{
|
|
|
- if (argc < 2 || argc > 4) {
|
|
|
- cerr << "Usage: " << argv[0] << " r [num_threads [num_pirs]]\n";
|
|
|
+ if (argc < 2 || argc > 5) {
|
|
|
+ cerr << "Usage: " << argv[0] << " r [num_threads [num_preproc [num_pirs]]]\n";
|
|
|
cerr << "r = log_2(num_records)\n";
|
|
|
exit(1);
|
|
|
}
|
|
|
- uint32_t r, num_threads = 1, num_pirs = 1;
|
|
|
+ uint32_t r, num_threads = 1, num_preproc = 1, num_pirs = 1;
|
|
|
r = strtoul(argv[1], NULL, 10);
|
|
|
if (argc > 2) {
|
|
|
num_threads = strtoul(argv[2], NULL, 10);
|
|
|
}
|
|
|
if (argc > 3) {
|
|
|
- num_pirs = strtoul(argv[3], NULL, 10);
|
|
|
+ num_preproc = strtoul(argv[3], NULL, 10);
|
|
|
+ }
|
|
|
+ if (argc > 4) {
|
|
|
+ num_pirs = strtoul(argv[4], NULL, 10);
|
|
|
+ } else {
|
|
|
+ num_pirs = num_preproc;
|
|
|
}
|
|
|
|
|
|
cout << "===== ONE-TIME SETUP =====\n\n";
|
|
@@ -37,12 +43,11 @@ int main(int argc, char **argv)
|
|
|
SPIR::init(num_threads);
|
|
|
string pub_params;
|
|
|
SPIR_Client client(r, pub_params);
|
|
|
- printf("%u %u %u %u\n", (unsigned char)pub_params[0], (unsigned
|
|
|
- char)pub_params[1], (unsigned char)pub_params[2],
|
|
|
- (unsigned char)pub_params[3]);
|
|
|
+ cout << "pub_params len = " << pub_params.length() << "\n";
|
|
|
+ SPIR_Server server(r, pub_params);
|
|
|
|
|
|
size_t otsetup_us = elapsed_us(&otsetup_start);
|
|
|
- cout << "OT one-time setup: " << otsetup_us << " µs\n";
|
|
|
+ cout << "One-time setup: " << otsetup_us << " µs\n";
|
|
|
|
|
|
return 0;
|
|
|
}
|