diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..81d99274 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,78 @@ +{ + "files.associations": { + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "chrono": "cpp", + "codecvt": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "variant": "cpp", + "csetjmp": "cpp", + "any": "cpp", + "cfenv": "cpp", + "charconv": "cpp", + "cuchar": "cpp", + "forward_list": "cpp", + "unordered_set": "cpp", + "regex": "cpp", + "scoped_allocator": "cpp", + "valarray": "cpp" + } +} diff --git a/examples/C/mpc/test_inputs/add_1.txt b/examples/C/mpc/test_inputs/add_1.txt new file mode 100644 index 00000000..fa84dcf7 --- /dev/null +++ b/examples/C/mpc/test_inputs/add_1.txt @@ -0,0 +1,7 @@ +// server +a 1 +b 0 + +// client +a 0 +b 2 \ No newline at end of file diff --git a/output1.txt b/output1.txt deleted file mode 100644 index bfc58daf..00000000 --- a/output1.txt +++ /dev/null @@ -1,351 +0,0 @@ -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_1.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -84992 - 1.04 seconds -Cgl0004I processed model has 20004 rows, 13023 columns (13023 integer (13023 of which binary)) and 59011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 84992 -Cbc0038I Before mini branch and bound, 13023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (1.17 seconds) -Cbc0038I After 1.17 seconds - Feasibility pump exiting with objective of 84992 - took 0.02 seconds -Cbc0012I Integer solution of 84992 found by feasibility pump after 0 iterations and 0 nodes (1.17 seconds) -Cbc0001I Search completed - best objective 84992, took 0 iterations and 0 nodes (1.18 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 84992 to 84992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -84992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 1.24 -Time (Wallclock seconds): 1.34 - -Total time (CPU seconds): 1.24 (Wallclock seconds): 1.34 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_2.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -169992 - 17.44 seconds -Cgl0004I processed model has 40004 rows, 26023 columns (26023 integer (26023 of which binary)) and 118011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 169992 -Cbc0038I Before mini branch and bound, 26023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (17.71 seconds) -Cbc0038I After 17.71 seconds - Feasibility pump exiting with objective of 169992 - took 0.05 seconds -Cbc0012I Integer solution of 169992 found by feasibility pump after 0 iterations and 0 nodes (17.72 seconds) -Cbc0001I Search completed - best objective 169992, took 0 iterations and 0 nodes (17.75 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 169992 to 169992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -169992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 17.88 -Time (Wallclock seconds): 18.07 - -Total time (CPU seconds): 17.88 (Wallclock seconds): 18.07 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_3.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -254992 - 31.61 seconds -Cgl0004I processed model has 60004 rows, 39023 columns (39023 integer (39023 of which binary)) and 177011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 254992 -Cbc0038I Before mini branch and bound, 39023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (32.07 seconds) -Cbc0038I After 32.07 seconds - Feasibility pump exiting with objective of 254992 - took 0.10 seconds -Cbc0012I Integer solution of 254992 found by feasibility pump after 0 iterations and 0 nodes (32.09 seconds) -Cbc0001I Search completed - best objective 254992, took 0 iterations and 0 nodes (32.14 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 254992 to 254992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -254992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 32.35 -Time (Wallclock seconds): 32.55 - -Total time (CPU seconds): 32.35 (Wallclock seconds): 32.55 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_4.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -339992 - 47.89 seconds -Cgl0004I processed model has 80004 rows, 52023 columns (52023 integer (52023 of which binary)) and 236011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 339992 -Cbc0038I Before mini branch and bound, 52023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (48.53 seconds) -Cbc0038I After 48.53 seconds - Feasibility pump exiting with objective of 339992 - took 0.13 seconds -Cbc0012I Integer solution of 339992 found by feasibility pump after 0 iterations and 0 nodes (48.55 seconds) -Cbc0001I Search completed - best objective 339992, took 0 iterations and 0 nodes (48.63 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 339992 to 339992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -339992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 48.97 -Time (Wallclock seconds): 49.32 - -Total time (CPU seconds): 48.97 (Wallclock seconds): 49.32 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_5.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -424992 - 61.73 seconds -Cgl0004I processed model has 100004 rows, 65023 columns (65023 integer (65023 of which binary)) and 295011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 424992 -Cbc0038I Before mini branch and bound, 65023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (62.58 seconds) -Cbc0038I After 62.58 seconds - Feasibility pump exiting with objective of 424992 - took 0.17 seconds -Cbc0012I Integer solution of 424992 found by feasibility pump after 0 iterations and 0 nodes (62.61 seconds) -Cbc0001I Search completed - best objective 424992, took 0 iterations and 0 nodes (62.71 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 424992 to 424992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -424992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 63.16 -Time (Wallclock seconds): 63.62 - -Total time (CPU seconds): 63.16 (Wallclock seconds): 63.62 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_6.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -509992 - 78.45 seconds -Cgl0004I processed model has 120004 rows, 78023 columns (78023 integer (78023 of which binary)) and 354011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 509992 -Cbc0038I Before mini branch and bound, 78023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (79.47 seconds) -Cbc0038I After 79.47 seconds - Feasibility pump exiting with objective of 509992 - took 0.18 seconds -Cbc0012I Integer solution of 509992 found by feasibility pump after 0 iterations and 0 nodes (79.50 seconds) -Cbc0001I Search completed - best objective 509992, took 0 iterations and 0 nodes (79.61 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 509992 to 509992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -509992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 80.21 -Time (Wallclock seconds): 80.80 - -Total time (CPU seconds): 80.21 (Wallclock seconds): 80.80 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_7.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -594992 - 138.52 seconds -Cgl0004I processed model has 140004 rows, 91023 columns (91023 integer (91023 of which binary)) and 413011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 594992 -Cbc0038I Before mini branch and bound, 91023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (139.85 seconds) -Cbc0038I After 139.85 seconds - Feasibility pump exiting with objective of 594992 - took 0.26 seconds -Cbc0012I Integer solution of 594992 found by feasibility pump after 0 iterations and 0 nodes (139.88 seconds) -Cbc0001I Search completed - best objective 594992, took 0 iterations and 0 nodes (140.00 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 594992 to 594992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -594992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 140.76 -Time (Wallclock seconds): 141.60 - -Total time (CPU seconds): 140.76 (Wallclock seconds): 141.60 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_8.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -679992 - 176.22 seconds -Cgl0004I processed model has 160004 rows, 104023 columns (104023 integer (104023 of which binary)) and 472011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 679992 -Cbc0038I Before mini branch and bound, 104023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (177.73 seconds) -Cbc0038I After 177.73 seconds - Feasibility pump exiting with objective of 679992 - took 0.30 seconds -Cbc0012I Integer solution of 679992 found by feasibility pump after 0 iterations and 0 nodes (177.77 seconds) -Cbc0001I Search completed - best objective 679992, took 0 iterations and 0 nodes (177.94 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 679992 to 679992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -679992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 178.93 -Time (Wallclock seconds): 179.74 - -Total time (CPU seconds): 178.93 (Wallclock seconds): 179.74 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_9.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -764992 - 186.23 seconds -Cgl0004I processed model has 180004 rows, 117023 columns (117023 integer (117023 of which binary)) and 531011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 764992 -Cbc0038I Before mini branch and bound, 117023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (187.96 seconds) -Cbc0038I After 187.96 seconds - Feasibility pump exiting with objective of 764992 - took 0.34 seconds -Cbc0012I Integer solution of 764992 found by feasibility pump after 0 iterations and 0 nodes (188.01 seconds) -Cbc0001I Search completed - best objective 764992, took 0 iterations and 0 nodes (188.19 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 764992 to 764992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -764992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 189.31 -Time (Wallclock seconds): 190.20 - -Total time (CPU seconds): 189.31 (Wallclock seconds): 190.20 - diff --git a/output2.txt b/output2.txt deleted file mode 100644 index c57af760..00000000 --- a/output2.txt +++ /dev/null @@ -1,351 +0,0 @@ -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_1.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -169992 - 16.54 seconds -Cgl0004I processed model has 40004 rows, 26023 columns (26023 integer (26023 of which binary)) and 118011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 169992 -Cbc0038I Before mini branch and bound, 26023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (16.81 seconds) -Cbc0038I After 16.81 seconds - Feasibility pump exiting with objective of 169992 - took 0.06 seconds -Cbc0012I Integer solution of 169992 found by feasibility pump after 0 iterations and 0 nodes (16.82 seconds) -Cbc0001I Search completed - best objective 169992, took 0 iterations and 0 nodes (16.85 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 169992 to 169992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -169992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 16.98 -Time (Wallclock seconds): 17.14 - -Total time (CPU seconds): 16.98 (Wallclock seconds): 17.14 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_2.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -339992 - 38.37 seconds -Cgl0004I processed model has 80004 rows, 52023 columns (52023 integer (52023 of which binary)) and 236011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 339992 -Cbc0038I Before mini branch and bound, 52023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (39.05 seconds) -Cbc0038I After 39.05 seconds - Feasibility pump exiting with objective of 339992 - took 0.13 seconds -Cbc0012I Integer solution of 339992 found by feasibility pump after 0 iterations and 0 nodes (39.06 seconds) -Cbc0001I Search completed - best objective 339992, took 0 iterations and 0 nodes (39.13 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 339992 to 339992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -339992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 39.47 -Time (Wallclock seconds): 39.85 - -Total time (CPU seconds): 39.47 (Wallclock seconds): 39.85 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_3.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -509992 - 81.53 seconds -Cgl0004I processed model has 120004 rows, 78023 columns (78023 integer (78023 of which binary)) and 354011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 509992 -Cbc0038I Before mini branch and bound, 78023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (82.55 seconds) -Cbc0038I After 82.55 seconds - Feasibility pump exiting with objective of 509992 - took 0.21 seconds -Cbc0012I Integer solution of 509992 found by feasibility pump after 0 iterations and 0 nodes (82.58 seconds) -Cbc0001I Search completed - best objective 509992, took 0 iterations and 0 nodes (82.70 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 509992 to 509992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -509992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 83.31 -Time (Wallclock seconds): 83.88 - -Total time (CPU seconds): 83.31 (Wallclock seconds): 83.88 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_4.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -679992 - 5.17 seconds -Cgl0004I processed model has 160004 rows, 104023 columns (104023 integer (104023 of which binary)) and 472011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 679992 -Cbc0038I Before mini branch and bound, 104023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (6.63 seconds) -Cbc0038I After 6.63 seconds - Feasibility pump exiting with objective of 679992 - took 0.27 seconds -Cbc0012I Integer solution of 679992 found by feasibility pump after 0 iterations and 0 nodes (6.68 seconds) -Cbc0001I Search completed - best objective 679992, took 0 iterations and 0 nodes (6.85 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 679992 to 679992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -679992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 7.43 -Time (Wallclock seconds): 7.89 - -Total time (CPU seconds): 7.43 (Wallclock seconds): 7.89 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_5.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -849992 - 285.77 seconds -Cgl0004I processed model has 200004 rows, 130023 columns (130023 integer (130023 of which binary)) and 590011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 849992 -Cbc0038I Before mini branch and bound, 130023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (287.74 seconds) -Cbc0038I After 287.74 seconds - Feasibility pump exiting with objective of 849992 - took 0.39 seconds -Cbc0012I Integer solution of 849992 found by feasibility pump after 0 iterations and 0 nodes (287.79 seconds) -Cbc0001I Search completed - best objective 849992, took 0 iterations and 0 nodes (288.03 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 849992 to 849992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -849992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 289.52 -Time (Wallclock seconds): 290.49 - -Total time (CPU seconds): 289.52 (Wallclock seconds): 290.49 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_6.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -1.01999e+06 - 498.81 seconds -Cgl0004I processed model has 240004 rows, 156023 columns (156023 integer (156023 of which binary)) and 708011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 1.01999e+06 -Cbc0038I Before mini branch and bound, 156023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (501.69 seconds) -Cbc0038I After 501.69 seconds - Feasibility pump exiting with objective of 1.01999e+06 - took 0.52 seconds -Cbc0012I Integer solution of 1019992 found by feasibility pump after 0 iterations and 0 nodes (501.77 seconds) -Cbc0001I Search completed - best objective 1019992, took 0 iterations and 0 nodes (502.09 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 1.01999e+06 to 1.01999e+06 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -1019992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 504.09 -Time (Wallclock seconds): 506.03 - -Total time (CPU seconds): 504.09 (Wallclock seconds): 506.03 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_7.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -1.18999e+06 - 18.77 seconds -Cgl0004I processed model has 280004 rows, 182023 columns (182023 integer (182023 of which binary)) and 826011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 1.18999e+06 -Cbc0038I Before mini branch and bound, 182023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (21.66 seconds) -Cbc0038I After 21.66 seconds - Feasibility pump exiting with objective of 1.18999e+06 - took 0.57 seconds -Cbc0012I Integer solution of 1189992 found by feasibility pump after 0 iterations and 0 nodes (21.74 seconds) -Cbc0001I Search completed - best objective 1189992, took 0 iterations and 0 nodes (22.04 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 1.18999e+06 to 1.18999e+06 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -1189992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 23.25 -Time (Wallclock seconds): 24.30 - -Total time (CPU seconds): 23.25 (Wallclock seconds): 24.30 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_8.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -1.35999e+06 - 1020.30 seconds -Cgl0004I processed model has 320004 rows, 208023 columns (208023 integer (208023 of which binary)) and 944011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 1.35999e+06 -Cbc0038I Before mini branch and bound, 208023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (1024.39 seconds) -Cbc0038I After 1024.39 seconds - Feasibility pump exiting with objective of 1.35999e+06 - took 0.78 seconds -Cbc0012I Integer solution of 1359992 found by feasibility pump after 0 iterations and 0 nodes (1024.50 seconds) -Cbc0001I Search completed - best objective 1359992, took 0 iterations and 0 nodes (1024.96 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 1.35999e+06 to 1.35999e+06 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -1359992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 1028.31 -Time (Wallclock seconds): 1032.55 - -Total time (CPU seconds): 1028.31 (Wallclock seconds): 1032.55 - -Options { input_file_path: "./examples/C/mpc/ilp_benchmarks/2pc_ilp_bench_9.c", inputs: None, parties: Some(2), maximize: false } -Done with IR optimization -Converting to aby -Welcome to the CBC MILP Solver -Version: 2.10.3 -Build Date: Mar 24 2020 - -command line - Cbc_C_Interface -solve -quit (default strategy 1) -Continuous objective value is -764992 - 309.78 seconds -Cgl0004I processed model has 180004 rows, 117023 columns (117023 integer (117023 of which binary)) and 531011 elements -Cutoff increment increased from 1e-05 to 0.1999 -Cbc0038I Initial state - 0 integers unsatisfied sum - 0 -Cbc0038I Solution found of 764992 -Cbc0038I Before mini branch and bound, 117023 integers at bound fixed and 0 continuous -Cbc0038I Mini branch and bound did not improve solution (311.74 seconds) -Cbc0038I After 311.74 seconds - Feasibility pump exiting with objective of 764992 - took 0.38 seconds -Cbc0012I Integer solution of 764992 found by feasibility pump after 0 iterations and 0 nodes (311.81 seconds) -Cbc0001I Search completed - best objective 764992, took 0 iterations and 0 nodes (312.04 seconds) -Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost -Cuts at root node changed objective from 764992 to 764992 -Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) -ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds) - -Result - Optimal solution found - -Objective value: -764992.00000000 -Enumerated nodes: 0 -Total iterations: 0 -Time (CPU seconds): 313.23 -Time (Wallclock seconds): 314.35 - -Total time (CPU seconds): 313.23 (Wallclock seconds): 314.35 - diff --git a/scripts/aby_tests/c_test_aby.py b/scripts/aby_tests/c_test_aby.py index 4b4e8640..9769783d 100755 --- a/scripts/aby_tests/c_test_aby.py +++ b/scripts/aby_tests/c_test_aby.py @@ -4,20 +4,22 @@ from utils import run_tests from test_suite import * if __name__ == "__main__": - tests = arithmetic_tests + \ - mod_tests + \ - arithmetic_boolean_tests + \ - nary_arithmetic_tests + \ - bitwise_tests + \ - boolean_tests + \ - nary_boolean_tests + \ - const_arith_tests + \ - const_bool_tests + \ - ite_tests + \ - c_array_tests + \ - div_tests + \ - array_tests + # tests = arithmetic_tests + \ + # mod_tests + \ + # arithmetic_boolean_tests + \ + # nary_arithmetic_tests + \ + # bitwise_tests + \ + # boolean_tests + \ + # nary_boolean_tests + \ + # const_arith_tests + \ + # const_bool_tests + \ + # ite_tests + \ + # c_array_tests + \ + # div_tests + \ + # array_tests # shift_tests + + tests = add_tests # TODO: add support for return value - int promotion # unsigned_arithmetic_tests + \ diff --git a/scripts/aby_tests/test_suite.py b/scripts/aby_tests/test_suite.py index ec0a5b3f..8979503c 100644 --- a/scripts/aby_tests/test_suite.py +++ b/scripts/aby_tests/test_suite.py @@ -1,3 +1,12 @@ +add_tests = [ + [ + "Add two numbers - 1", + 3, + "./third_party/ABY/build/bin/2pc_add", + "./examples/C/mpc/test_inputs/add_1.txt", + ], +] + arithmetic_tests = [ [ "Add two numbers - 1", diff --git a/scripts/aby_tests/utils.py b/scripts/aby_tests/utils.py index 3ce384b3..c66cfc5e 100644 --- a/scripts/aby_tests/utils.py +++ b/scripts/aby_tests/utils.py @@ -1,7 +1,6 @@ from subprocess import Popen, PIPE import sys from typing import List -import time def init_progress_bar(toolbar_width=40): ''' Initialize progress bar ''' @@ -34,11 +33,11 @@ def update_path(path: str, lang: str) -> str: '''Append path with language type''' return f'{path}_{lang}_test' -def build_server_cmd(exec: str, args: dict) -> List[str]: - return [exec, "-r", "0", "-i"] + flatten_args(args) +def build_server_cmd(exec: str, test_file: str) -> List[str]: + return [exec, "-m", "mpc", "-r", "0", "-t", test_file] -def build_client_cmd(exec: str, args: dict) -> List[str]: - return [exec, "-r", "1", "-i"] + flatten_args(args) +def build_client_cmd(exec: str, test_file: str) -> List[str]: + return [exec, "-m", "mpc", "-r", "1", "-t", test_file] def run_test(desc: str, expected: str, server_cmd: List[str], client_cmd: List[str]) -> bool: assert len(server_cmd) > 3, "server cmd does not have enough arguments" @@ -72,8 +71,7 @@ def run_tests(lang: str, tests: List[dict]): 1. description of test case: string 2. expected output: string 3. executable path: string - 4. server arguments: dict[name] = value - 5. client arguments: dict[name] = value + 4. test file path: string ''' print("Running tests for frontend", lang) failed_test_descs = [] @@ -81,12 +79,12 @@ def run_tests(lang: str, tests: List[dict]): progress_inc = 5 init_progress_bar(len(tests) // progress_inc + 1) for t, test in enumerate(tests): - assert len(test) == 5, "test configurations are wrong for test: "+test[0] + assert len(test) == 4, "test configurations are wrong for test: "+test[0] desc = test[0] expected = str(test[1]) path = update_path(test[2], lang) server_cmd = build_server_cmd(path, test[3]) - client_cmd = build_client_cmd(path, test[4]) + client_cmd = build_client_cmd(path, test[3]) test_results = [] for i in range(num_retries): diff --git a/scripts/build_mpc_c_test.zsh b/scripts/build_mpc_c_test.zsh index 6e2cd888..170b842d 100755 --- a/scripts/build_mpc_c_test.zsh +++ b/scripts/build_mpc_c_test.zsh @@ -26,57 +26,57 @@ function mpc_test { # build mpc arithmetic tests mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_sub.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult_add_pub.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mod.c -# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add_unsigned.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_sub.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mult_add_pub.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_mod.c +# # mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_add_unsigned.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_equals.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_than.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_equals.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_than.c -mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_equals.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_equals.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_than.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_greater_equals.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_than.c +# mpc_test 2 ./examples/C/mpc/unit_tests/arithmetic_tests/2pc_int_less_equals.c -# build mpc nary arithmetic tests -mpc_test 2 ./examples/C/mpc/unit_tests/nary_arithmetic_tests/2pc_nary_arithmetic_add.c +# # build mpc nary arithmetic tests +# mpc_test 2 ./examples/C/mpc/unit_tests/nary_arithmetic_tests/2pc_nary_arithmetic_add.c -# build mpc bitwise tests -mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_and.c -mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_or.c -mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_xor.c +# # build mpc bitwise tests +# mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_and.c +# mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_or.c +# mpc_test 2 ./examples/C/mpc/unit_tests/bitwise_tests/2pc_bitwise_xor.c -# build mpc boolean tests -mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_and.c -mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_or.c -mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_equals.c +# # build mpc boolean tests +# mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_and.c +# mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_or.c +# mpc_test 2 ./examples/C/mpc/unit_tests/boolean_tests/2pc_boolean_equals.c -# build mpc nary boolean tests -mpc_test 2 ./examples/C/mpc/unit_tests/nary_boolean_tests/2pc_nary_boolean_and.c +# # build mpc nary boolean tests +# mpc_test 2 ./examples/C/mpc/unit_tests/nary_boolean_tests/2pc_nary_boolean_and.c -# build mpc const tests -mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_arith.c -mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_bool.c +# # build mpc const tests +# mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_arith.c +# mpc_test 2 ./examples/C/mpc/unit_tests/const_tests/2pc_const_bool.c -# build if statement tests -mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_bool.c -mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_int.c -mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_only_if.c +# # build if statement tests +# mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_bool.c +# mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_ret_int.c +# mpc_test 2 ./examples/C/mpc/unit_tests/ite_tests/2pc_ite_only_if.c -# build div tests -mpc_test 2 ./examples/C/mpc/unit_tests/div_tests/2pc_div.c +# # build div tests +# mpc_test 2 ./examples/C/mpc/unit_tests/div_tests/2pc_div.c -# build array tests -mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_sum.c -mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index.c -mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index_2.c +# # build array tests +# mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_sum.c +# mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index.c +# mpc_test 2 ./examples/C/mpc/unit_tests/array_tests/2pc_array_index_2.c -# build circ/compiler array tests -mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array.c -mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_1.c -mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_2.c -mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_3.c -mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_sum_c.c +# # build circ/compiler array tests +# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array.c +# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_1.c +# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_2.c +# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_3.c +# mpc_test 2 ./examples/C/mpc/unit_tests/c_array_tests/2pc_array_sum_c.c # # # build shift tests # # mpc_test 2 ./examples/C/mpc/unit_tests/shift_tests/2pc_lhs.c diff --git a/scripts/input_parser.cpp b/scripts/input_parser.cpp new file mode 100644 index 00000000..beb90ee5 --- /dev/null +++ b/scripts/input_parser.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include +#include +#include + +enum mode { + mpc +}; + +mode hash(std::string m) { + if (m == "mpc") return mpc; + throw std::invalid_argument("Unknown mode: "+m); +} + +std::vector split(std::string str, char delimiter) { + std::vector result; + std::istringstream ss(str); + std::string word; + while (ss >> word) { + result.push_back(word); + } + return result; +} + +std::unordered_map parse_mpc_inputs(std::string test_file_path, int role) { + std::unordered_map input_map; + + std::ifstream file(test_file_path); + assert(("Test file exists.", file.is_open())); + + std::string str; + bool role_flag = false; + while (std::getline(file, str)) { + std::vector line = split(str, ' '); + if (line.size() == 0) continue; + if (line[0].rfind("// server", 0) == 0) { + if (role == 0) role_flag = true; + if (role == 1) role_flag = false; + continue; + } + if (line[0].rfind("// client", 0) == 0) { + if (role == 1) role_flag = true; + if (role == 0) role_flag = false; + continue; + } + if (role_flag) { + if (line.size() == 2) { + input_map[line[0]] = std::stoi(line[1]); + } else if (line.size() > 2) { + // Vector input, key_idx: value + for (int i = 1; i < line.size(); i++) { + std::string key = line[0] + "_" + std::to_string(i-1); + input_map[line[0]] = std::stoi(line[i]); + } + } + } + } + return input_map; +} + +int main (int argc, char* argv[]) { + + std::vector args(argv + 1, argv + argc); + std::string m, test_file_path; + for (auto i = args.begin(); i != args.end(); ++i) { + if (*i == "-m" || *i == "--mode") { + m = *++i; + } else if (*i == "-t" || *i == "--test_file") { + test_file_path = *++i; + } + } + + switch(hash(m)) { + case mpc: { + parse_mpc_inputs(test_file_path); + } + break; + } + return 0; +} \ No newline at end of file diff --git a/src/target/aby/trans.rs b/src/target/aby/trans.rs index 983b2b29..490e8e14 100644 --- a/src/target/aby/trans.rs +++ b/src/target/aby/trans.rs @@ -163,7 +163,7 @@ impl ToABY { write_line_to_file( &self.setup_fname, &format!( - "uint32_t {} = std::atoi(params[\"{}\"].c_str());\n", + "uint32_t {} = params[\"{}\"];\n", name_, self.parse_var_name(name.to_string()) ), @@ -613,16 +613,13 @@ pub fn to_aby(ir: Computation, path: &Path, lang: &str, cm: &str) { metadata: md, values: _, } = ir.clone(); - for t in terms.clone() { - println!("terms: {}", t); - } let s_map: SharingMap = assign(&ir, cm); // let s_map: SharingMap = some_arith_sharing(&ir); let mut converter = ToABY::new(md, s_map, path, lang); for t in terms { - println!("terms: {}", t); + // println!("terms: {}", t); converter.lower(t.clone()); } diff --git a/third_party/ABY_templates/cpp_template.txt b/third_party/ABY_templates/cpp_template.txt index d359fd73..c98c68d8 100644 --- a/third_party/ABY_templates/cpp_template.txt +++ b/third_party/ABY_templates/cpp_template.txt @@ -6,7 +6,7 @@ #include "../../../abycore/sharing/sharing.h" -int32_t test_{fn}_circuit(std::map params, e_role role, const std::string& address, +int32_t test_{fn}_circuit(std::unordered_map params, e_role role, const std::string& address, uint16_t port, seclvl seclvl, uint32_t bitlen, uint32_t nthreads, e_mt_gen_alg mt_alg, e_sharing sharing) { // setup diff --git a/third_party/ABY_templates/h_template.txt b/third_party/ABY_templates/h_template.txt index cf08bd29..a929d96f 100644 --- a/third_party/ABY_templates/h_template.txt +++ b/third_party/ABY_templates/h_template.txt @@ -5,5 +5,5 @@ #include #include -int32_t test_{fn}_circuit(std::map params, e_role role, const std::string& address, +int32_t test_{fn}_circuit(std::unordered_map params, e_role role, const std::string& address, uint16_t port, seclvl seclvl, uint32_t bitlen, uint32_t nthreads, e_mt_gen_alg mt_alg, e_sharing sharing); \ No newline at end of file diff --git a/third_party/ABY_templates/test_template.txt b/third_party/ABY_templates/test_template.txt index caabac9c..64c31dfb 100644 --- a/third_party/ABY_templates/test_template.txt +++ b/third_party/ABY_templates/test_template.txt @@ -1,5 +1,12 @@ #include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -8,105 +15,91 @@ #include "common/{fn}.h" -int32_t read_test_options(int32_t* argcp, char*** argvp, e_role* role, - uint32_t* bitlen, uint32_t* nvals, uint32_t* secparam, std::string* address, - uint16_t* port, int32_t* test_op, std::string* parameters) { +enum mode { + mpc +}; - uint32_t int_role = 0, int_port = 0; - - parsing_ctx options[] = - { { (void*) &int_role, T_NUM, "r", "Role: 0/1", true, false }, { - (void*) parameters, T_PARAMETERS, "i", - "MPC Parameters", true, false }, { - (void*) nvals, T_NUM, "n", - "Number of parallel operation elements", false, false }, { - (void*) bitlen, T_NUM, "b", "Bit-length, default 32", false, - false }, { (void*) secparam, T_NUM, "s", - "Symmetric Security Bits, default: 128", false, false }, { - (void*) address, T_STR, "a", - "IP-address, default: localhost", false, false }, { - (void*) &int_port, T_NUM, "p", "Port, default: 7766", false, - false }, { (void*) test_op, T_NUM, "t", - "Single test (leave out for all operations), default: off", - false, false } }; - - if (!parse_options(argcp, argvp, options, - sizeof(options) / sizeof(parsing_ctx))) { - print_usage(*argvp[0], options, sizeof(options) / sizeof(parsing_ctx)); - std::cout << "Exiting" << std::endl; - exit(0); - } - - assert(int_role < 2); - *role = (e_role) int_role; - - if (int_port != 0) { - assert(int_port < 1 << (sizeof(uint16_t) * 8)); - *port = (uint16_t) int_port; - } - - return 1; +mode hash(std::string m) { + if (m == "mpc") return mpc; + throw std::invalid_argument("Unknown mode: "+m); } -std::map parameters_to_map(std::string s, std::string del = ",") { - std::vector v = {}; - int start = 0; - int end = s.find(del); - while (end != -1) { - v.push_back(s.substr(start, end - start)); - start = end + del.size(); - end = s.find(del, start); +std::vector split(std::string str, char delimiter) { + std::vector result; + std::istringstream ss(str); + std::string word; + while (ss >> word) { + result.push_back(word); } - v.push_back(s.substr(start, end - start)); - - // TODO: this input parameter map does not support strings since it - // uses strings as parameter keys - - std::map m; - int idx = 0; - std::string base_key = ""; - for (int i = 0; i < v.size(); i++) { - if (!isdigit(*v[i].c_str())) { - idx = 0; - base_key = v[i]; - } else { - std::string key = ""; - if (i+1 < v.size()) { - if (idx == 0 && !isdigit(*v[i+1].c_str())) { - key = base_key; - } - else { - key = base_key + '_' + std::to_string(idx); - idx++; - } - } else if (idx > 0) { - key = base_key + '_' + std::to_string(idx); - } else { - key = base_key; - } - m[key] = v[i]; - } - } - return m; + return result; } +std::unordered_map parse_mpc_inputs(std::string test_file_path, int role) { + std::unordered_map input_map; + + std::ifstream file(test_file_path); + assert(("Test file exists.", file.is_open())); + + std::string str; + bool role_flag = false; + while (std::getline(file, str)) { + std::vector line = split(str, ' '); + if (line.size() == 0) continue; + if (line[0].rfind("//", 0) == 0 && line[1] == "server") { + if (role == 0) role_flag = true; + if (role == 1) role_flag = false; + continue; + } + if (line[0].rfind("//", 0) == 0 && line[1] == "client") { + if (role == 1) role_flag = true; + if (role == 0) role_flag = false; + continue; + } + if (role_flag) { + if (line.size() == 2) { + input_map[line[0]] = std::stoi(line[1]); + } else if (line.size() > 2) { + // Vector input, key_idx: value + for (int i = 1; i < line.size(); i++) { + std::string key = line[0] + "_" + std::to_string(i-1); + input_map[line[0]] = std::stoi(line[i]); + } + } + } + } + return input_map; +} + int main(int argc, char** argv) { - - e_role role; + e_role role; uint32_t bitlen = 32, nvals = 31, secparam = 128, nthreads = 1; uint16_t port = 7766; std::string address = "127.0.0.1"; int32_t test_op = -1; e_mt_gen_alg mt_alg = MT_OT; - std::string parameters = ""; - - read_test_options(&argc, &argv, &role, &bitlen, &nvals, &secparam, &address, - &port, &test_op, ¶meters); - seclvl seclvl = get_sec_lvl(secparam); - std::map params = parameters_to_map(parameters, ","); + std::vector args(argv + 1, argv + argc); + std::string m, test_file_path; + for (auto i = args.begin(); i != args.end(); ++i) { + if (*i == "-m" || *i == "--mode") { + m = *++i; + } else if (*i == "-r" || *i == "--role") { + role = (e_role) std::stoi(*++i); + } else if (*i == "-t" || *i == "--test_file") { + test_file_path = *++i; + } + } + + std::unordered_map params; + + switch(hash(m)) { + case mpc: { + params = parse_mpc_inputs(test_file_path, (int) role); + } + break; + } test_{fn}_circuit(params, role, address, port, seclvl, 32, nthreads, mt_alg, S_BOOL);