MCPcopy Create free account
hub / github.com/Derious/cuMPC / OpenVec

Function OpenVec

test/test_mpc/test_lut_eval.cpp:10–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#define bench 10
9
10void OpenVec(NetIO* io, ThreadPool * pool, int64_t* value, int64_t* share_value, int length, int party) {
11
12 int64_t* tmp = new int64_t[length];
13 auto start = emp::clock_start();
14 if(party == 1){
15 io->send_data(share_value,length*sizeof(int64_t));
16 io->flush();
17 io->recv_data(tmp,length*sizeof(int64_t));
18 io->flush();
19 }
20 else{
21 io->recv_data(tmp,length*sizeof(int64_t));
22 io->flush();
23 io->send_data(share_value,length*sizeof(int64_t));
24 io->flush();
25 }
26
27 // vector<future<void>> res;//relic multi-thread problems...
28 // res.push_back(pool->enqueue([io,share_value,tmp,length,party2]() {
29 // io->send_data(share_value,length*sizeof(int64_t));
30 // io->flush();
31 // io->recv_data(tmp[party2],length*sizeof(int64_t));
32 // io->flush();
33 // }));
34 // // res.push_back(pool->enqueue([io,tmp,length,party2]() {
35
36 // // }));
37 // joinNclean(res);
38 double end = emp::time_from(start);
39 printf("Open Vec Time taken: %f milliseconds\n", end/1000);
40
41 start = emp::clock_start();
42 for (int j = 0; j < length; j++)
43 {
44
45 value[j] += tmp[j];
46 // cout<<"delta_a:"<<delta_i[i]<<"\tdelta_b:"<<delta2_i[i]<<"\tdeltab:"<<deltab<<endl;
47 #ifdef _debug_
48 cout<<"share_value:"<<tmp[i]<<endl;
49 #endif
50
51 #ifdef _debug_
52 cout<<"sum:"<<sum<<endl;
53 #endif
54 // value[j] = sum[j];
55 }
56 end = emp::time_from(start);
57 printf("Sum Time taken: %f milliseconds\n", end/1000);
58
59 delete[] tmp;
60 }
61
62
63int main(int argc, char** argv) {

Callers

nothing calls this directly

Calls 3

send_dataMethod · 0.80
flushMethod · 0.80
recv_dataMethod · 0.80

Tested by

no test coverage detected