-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbs.cpp
50 lines (43 loc) · 1.59 KB
/
bs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <limits.h>
#include <float.h>
#include "connection/Headers.h"
#include "connection/NodeConfiguration.h"
#include "connection/NodeNetwork.h"
#include "RSS_NN/BS.h"
#include "RSS_NN/Neural.h"
NodeConfiguration* nodeConfig;
NodeNetwork* nNet;
int __original_main(int _argc_ignored, char **_argv_ignored){
int size = pow(2, atoi(_argv_ignored[4])); //intput power of 2
// int size = atoi(_argv_ignored[4]); // input size directly
int batch_size = atoi(_argv_ignored[6]); // input size directly
int alpha = atoi(_argv_ignored[7]);
int alpha2 = atoi(_argv_ignored[8]);
BS(nNet, nodeConfig, size, batch_size, alpha, alpha2);
//neural_main(nNet, nodeConfig, size, batch_size);
return 0;
}
/* smc-compiler generated main() */
int main(int argc, char **argv){
if(argc < 9){
fprintf(stderr,"Incorrect input parameters\n");
fprintf(stderr,"Usage: <id> <runtime-config> <privatekey-filename> <size of data(2^x)> <ring size(x bits)> <batch_size>, <alpha(only for hybird2)>, <alpha2(only for hybird3)>\n");
exit(1);
}
nodeConfig = new NodeConfiguration(atoi(argv[1]), argv[2], 128);
std::cout << "Creating the NodeNetwork\n";
nNet = new NodeNetwork(nodeConfig, argv[3], 1, atoi(argv[5]),3);
printf("ok here \n");
struct timeval start;
struct timeval end;
unsigned long timer;
int _xval = 0;
gettimeofday(&start,NULL); //start timer here
_xval = (int) __original_main(argc, argv);
gettimeofday(&end,NULL);//stop timer here
delete nodeConfig;
delete nNet;
timer = 1000000 * (end.tv_sec-start.tv_sec)+ end.tv_usec-start.tv_usec;
printf("Total runtime = %ld us\n",timer);
return (_xval);
}