-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
60 lines (50 loc) · 2.24 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
# DB location values
DB_FILE_NAME=rand_db.json
DB_FILE_PATH=data/${DB_FILE_NAME}
PARAMS_OUTPUT_PATH=data/params.json
PREVIOUS_DIR=..
# cargo build values
# these are the FrodoPIR parameters to be used for benchmarking
MATRIX_HEIGHT_EXP=16
LWE_DIMENSION=1774
ELEMENT_SIZE_EXP=13
PLAINTEXT_SIZE_EXP=10
NUM_SHARDS=8
# rust flags
RUST_BACKTRACE=1
# python db generation values
DB_ALL_ONES=0
DB_NUM_ENTRIES_EXP=${MATRIX_HEIGHT_EXP}
RUST_FLAGS=RUST_BACKTRACE=${RUST_BACKTRACE}
DB_ENV=DB_FILE=${PREVIOUS_DIR}/${DB_FILE_PATH} PARAMS_OUTPUT_PATH=${PREVIOUS_DIR}/${PARAMS_OUTPUT_PATH}
PRELIM=${RUST_FLAGS} ${DB_ENV}
PIR_FLAGS=-m ${MATRIX_HEIGHT_EXP} --dim ${LWE_DIMENSION} --ele_size ${ELEMENT_SIZE_EXP} --plaintext_bits ${PLAINTEXT_SIZE_EXP} --num_shards ${NUM_SHARDS}
PIR_ENV=PIR_MATRIX_HEIGHT_EXP=${MATRIX_HEIGHT_EXP} PIR_LWE_DIM=${LWE_DIMENSION} PIR_ELEM_SIZE_EXP=${ELEMENT_SIZE_EXP} PIR_PLAINTEXT_BITS=${PLAINTEXT_SIZE_EXP} PIR_NUM_SHARDS=${NUM_SHARDS}
PIR_ENV_ALL=PIR_LWE_DIM=${LWE_DIMENSION} PIR_ELEM_SIZE_EXP=${ELEMENT_SIZE_EXP} PIR_NUM_SHARDS=${NUM_SHARDS}
DB_GEN_PRELIM=DB_ALL_ONES=${DB_ALL_ONES} DB_NUM_ENTRIES_EXP=${DB_NUM_ENTRIES_EXP} DB_OUTPUT_PATH=${DB_FILE_PATH} DB_ELEMENT_SIZE_EXP=${ELEMENT_SIZE_EXP}
LIB_PRELIM=${DB_FILE_PRELIM}
BIN_PRELIM=${BIN_DB_FILE_PRELIM} ${PARAMS_OUTPUT_PATH_PRELIM}
CARGO=cargo
CARGO_COMMAND=${PRELIM} ${CARGO}
PYTHON_COMMAND=${DB_GEN_PRELIM} python3
.PHONY: gen-db
gen-db:
${PYTHON_COMMAND} data/generate_db.py
.PHONY: build test docs bench bench-all
build:
${CARGO_COMMAND} build
test:
${CARGO_COMMAND} test -- --nocapture
LOOPS = 100
test-loop:
for ((i=1; i <= ${LOOPS}; ++i)) do make test && echo $$i || break; done
docs:
${CARGO} doc --open --no-deps
bench:
${PRELIM} ${PIR_ENV} ${CARGO} bench
bench-all:
${PRELIM} ${PIR_ENV_ALL} PIR_MATRIX_HEIGHT_EXP=16 PIR_PLAINTEXT_BITS=10 ${CARGO} bench > benchmarks-16.txt
${PRELIM} ${PIR_ENV_ALL} PIR_MATRIX_HEIGHT_EXP=17 PIR_PLAINTEXT_BITS=10 ${CARGO} bench > benchmarks-17.txt
${PRELIM} ${PIR_ENV_ALL} PIR_MATRIX_HEIGHT_EXP=18 PIR_PLAINTEXT_BITS=10 ${CARGO} bench > benchmarks-18.txt
${PRELIM} ${PIR_ENV_ALL} PIR_MATRIX_HEIGHT_EXP=19 PIR_PLAINTEXT_BITS=9 ${CARGO} bench > benchmarks-19.txt
${PRELIM} ${PIR_ENV_ALL} PIR_MATRIX_HEIGHT_EXP=20 PIR_PLAINTEXT_BITS=9 ${CARGO} bench > benchmarks-20.txt