-
Notifications
You must be signed in to change notification settings - Fork 5
/
makefile
executable file
·102 lines (77 loc) · 4.76 KB
/
makefile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Run make to see list of commands.
########################## Executable (Meteor.out) arguments ##########################
# arg[0]: Meteor.out
# arg[1]: Party number (0,1,2)
# arg[2]: File containing IP addresses of all parties
# arg[3]: AES key for local randomness generation (each party has a different file)
# arg[4]: AES key for common randomness generation (with next party)
# arg[5]: AES key for common randomness generation (with prev party)
# OPTIONAL ARGUMENTS: If supplied, these arguments take precedence over the ones in src/main.cpp
# Refer to Makefile Parameters section below for details.
# arg[6]: Which predefined network
# arg[7]: What dataset to use
# arg[8]: Which adversarial model
############################## Makefile parameters ######################################
# Location of OPENSSL installation if running over servers without sudo access
# OPEN_SSL_LOC := /data/swagh/conda
# RUN_TYPE {localhost, LAN or WAN}
RUN_TYPE := localhost
# NETWORK {SecureML, Sarda, MiniONN, LeNet, AlexNet, and VGG16}
NETWORK := AlexNet
# Dataset {MNIST, CIFAR10, and ImageNet}
DATASET := CIFAR10
# Security {Semi-honest or Malicious}
SECURITY:= Semi-honest # Malicious
#########################################################################################
#########################################################################################
CXX=g++
SRC_CPP_FILES := $(wildcard src/*.cpp)
OBJ_CPP_FILES := $(wildcard util/*.cpp)
OBJ_FILES := $(patsubst src/%.cpp, src/%.o,$(SRC_CPP_FILES))
OBJ_FILES += $(patsubst util/%.cpp, util/%.o,$(OBJ_CPP_FILES))
HEADER_FILES = $(wildcard src/*.h)
# FLAGS := -static -g -O0 -w -std=c++11 -pthread -msse4.1 -maes -msse2 -mpclmul -fpermissive -fpic
FLAGS := -O3 -w -std=c++11 -pthread -msse4.1 -maes -msse2 -mpclmul -fpic
LIBS := -lcrypto -lssl
OBJ_INCLUDES := -I 'lib_eigen/' -I 'util/Miracl/' -I 'util/' -I '$(OPEN_SSL_LOC)/include/'
BMR_INCLUDES := -L./ -L$(OPEN_SSL_LOC)/lib/ $(OBJ_INCLUDES)
help: ## Run make or make help to see list of options
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
all: Meteor.out ## Just compile the code
Meteor.out: $(OBJ_FILES)
g++ $(FLAGS) -o $@ $(OBJ_FILES) $(BMR_INCLUDES) $(LIBS)
%.o: %.cpp $(HEADER_FILES)
$(CXX) $(FLAGS) -c $< -o $@ $(OBJ_INCLUDES)
clean: ## Run this to clean all files
rm -rf Meteor.out
rm -rf src/*.o util/*.o
################################# Remote runs ##########################################
terminal: Meteor.out ## Run this to print the output of (only) Party 0 to terminal
./Meteor.out 2 files/IP_$(RUN_TYPE) files/keyC files/keyAC files/keyBC >/dev/null &
./Meteor.out 1 files/IP_$(RUN_TYPE) files/keyB files/keyBC files/keyAB >/dev/null &
./Meteor.out 0 files/IP_$(RUN_TYPE) files/keyA files/keyAB files/keyAC
@echo "Execution completed"
file: Meteor.out ## Run this to append the output of (only) Party 0 to file output/3PC.txt
mkdir -p output
./Meteor.out 2 files/IP_$(RUN_TYPE) files/keyC files/keyAC files/keyBC >/dev/null &
./Meteor.out 1 files/IP_$(RUN_TYPE) files/keyB files/keyBC files/keyAB >/dev/null &
./Meteor.out 0 files/IP_$(RUN_TYPE) files/keyA files/keyAB files/keyAC >>output/3PC.txt
@echo "Execution completed"
valg: Meteor.out ## Run this to execute (only) Party 0 using valgrind. Change FLAGS to -O0.
./Meteor.out 2 files/IP_$(RUN_TYPE) files/keyC files/keyAC files/keyBC >/dev/null &
./Meteor.out 1 files/IP_$(RUN_TYPE) files/keyB files/keyBC files/keyAB >/dev/null &
valgrind --tool=memcheck --leak-check=full --track-origins=yes --dsymutil=yes ./Meteor.out 0 files/IP_$(RUN_TYPE) files/keyA files/keyAB files/keyAC
command: Meteor.out ## Run this to use the run parameters specified in the makefile.
./Meteor.out 2 files/IP_$(RUN_TYPE) files/keyC files/keyAC files/keyBC $(NETWORK) $(DATASET) $(SECURITY) >>P2.txt &
./Meteor.out 1 files/IP_$(RUN_TYPE) files/keyB files/keyBC files/keyAB $(NETWORK) $(DATASET) $(SECURITY) >>P1.txt &
./Meteor.out 0 files/IP_$(RUN_TYPE) files/keyA files/keyAB files/keyAC $(NETWORK) $(DATASET) $(SECURITY) >>Meteor_P0.txt
@echo "Execution completed"
################################## tmux runs ############################################
zero: Meteor.out ## Run this to only execute Party 0 (useful for multiple terminal runs)
./Meteor.out 0 files/IP_$(RUN_TYPE) files/keyA files/keyAB files/keyAC
one: Meteor.out ## Run this to only execute Party 1 (useful for multiple terminal runs)
./Meteor.out 1 files/IP_$(RUN_TYPE) files/keyB files/keyBC files/keyAB
two: Meteor.out ## Run this to only execute Party 2 (useful for multiple terminal runs)
./Meteor.out 2 files/IP_$(RUN_TYPE) files/keyC files/keyAC files/keyBC
#########################################################################################
.PHONY: help