-
Notifications
You must be signed in to change notification settings - Fork 3
/
benchmark_commands.py
50 lines (40 loc) · 1.98 KB
/
benchmark_commands.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
42
43
44
45
46
47
48
49
50
# Read address from json file
import toml
config = toml.load('benchmark_config.toml')
addr = config["address"]
params = config["parameters"]
client = config["client"]
server = config["server"]
client_addr = addr['client']
alice_addr = addr['alice']
bob_addr = addr['bob']
client_name = client["bin"]
server_name = server["bin"]
gsize = params["gsize"]
num_clients = params["num_clients"]
num_mpc_sockets = server["num_mpc_sockets"]
input_size = params["input_size"]
client_flags = client["run_flags"]
server_flags = server["run_flags"]
client_compile_flags = client["build_flags"]
server_compile_flags = server["build_flags"]
flamegraph_alice = server["flamegraph_alice"]
flamegraph_bob = server["flamegraph_bob"]
run_cmd_alice = "cargo flamegraph" if flamegraph_alice else "cargo run --release"
run_cmd_bob = "cargo flamegraph" if flamegraph_bob else "cargo run --release"
meta_client_command = "RUSTFLAGS='-C target-cpu=native' cargo run --release --package {} {} -- " \
"{} -g {} -n {} -a {}:6666 -b {}:6667 -i {}".format(
client_name, client_compile_flags, client_flags, gsize, num_clients, alice_addr, bob_addr, input_size)
alice_command = "RUSTFLAGS='-C target-cpu=native' {} --package {} {} -- -g {} -n {} -m 7777 -p 6666 -s {} -i {} {}".format(
run_cmd_alice, server_name, server_compile_flags, gsize, num_clients, num_mpc_sockets, input_size,
server_flags)
bob_command = "RUSTFLAGS='-C target-cpu=native' {} --package {} {} -- -g {} -n {} -m {}:7777 -b -p 6667 -s {} -i {} {}".format(
run_cmd_bob, server_name, server_compile_flags, gsize, num_clients, alice_addr, num_mpc_sockets, input_size,
server_flags)
print("Meta Client: {}\n".format(meta_client_command))
print("Alice: {}\n".format(alice_command))
print("Bob: {}\n".format(bob_command))
if flamegraph_bob:
flamegraph_command = "scp -i ~/SecureFL.pem ubuntu@{}:~/eiffel-rs/flamegraph.svg .".format(
bob_addr)
print("Flamegraph Bob: {}\n".format(flamegraph_command))