forked from songleiW/SecGNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
60 lines (42 loc) · 1.48 KB
/
main.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
50
51
52
53
54
55
56
57
58
59
#include "typedef.h"
#include "util.h"
#include "test.h"
#include<ctime>
using namespace std;
extern long long lengthData,numMutilBool,numMutil;
int main() {
int flag=0;
clock_t startClock, endClock;
startClock = clock();
initMPC();
readData(flag);
selectTrainSet(40);
if (1) {
Init(1);
train();
endClock = clock();
double endtime = (double) (endClock - startClock) / CLOCKS_PER_SEC;
long long onCom=Online();
long long offCom=Offline();
cout <<"Online comm: " <<onCom<<" MB"<<endl;
cout <<"Offline comm: " <<offCom<<" MB"<<endl;
cout << "Training time: " << endtime / 120.0+ onCom/(dataRate*60.0)<< " minutes" << endl;
cout << "Offline Time: " << offCom/(dataRate*60.0)<< " minutes" << endl;
writeModel(flag);
}
else{
readModel(flag);
Init(0);
double accuracy = testData();
endClock = clock();
cout << "---Accuracy:" << accuracy << "---" << endl;
double endtime = (double) (endClock - startClock) / CLOCKS_PER_SEC;
long long onCom=Online();
long long offCom=Offline();
cout <<"Online comm: " <<onCom<<" MB"<<endl;
cout <<"Offline comm: " <<offCom<<" MB"<<endl;
cout << "Inference time: " << endtime / 120.0+ onCom/(dataRate*60.0)<< " minutes" << endl;
cout << "Offline Time: " << offCom/(dataRate*60.0)<< " minutes" << endl;
}
return 0;
}