forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.py
executable file
·41 lines (31 loc) · 1012 Bytes
/
compile.py
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
#!/usr/bin/env python3
# ===== Compiler usage instructions =====
#
# ./compile.py input_file
#
# will compile Programs/Source/input_file.mpc onto
# Programs/Bytecode/input_file.bc and Programs/Schedules/input_file.sch
#
# (run with --help for more options)
#
# See the compiler documentation at https://mp-spdz.readthedocs.io
# for details on the Compiler package
from Compiler.compilerLib import Compiler
def compilation(compiler):
prog = compiler.compile_file()
if prog.public_input_file is not None:
print(
"WARNING: %s is required to run the program" % prog.public_input_file.name
)
def main(compiler):
compiler.prep_compile()
if compiler.options.profile:
import cProfile
p = cProfile.Profile().runctx("compilation(compiler)", globals(), locals())
p.dump_stats(compiler.args[0] + ".prof")
p.print_stats(2)
else:
compilation(compiler)
if __name__ == "__main__":
compiler = Compiler()
main(compiler)