nopaxos.py 3.84 KB
Newer Older
1
2
3
4
import modes.experiments as exp
import modes.simulators as sim
import modes.nodeconfig as node

5
host_configs = ['qemu', 'gt']
6
seq_configs = ['swseq', 'ehseq']
7
nic_configs = ['ib', 'cb', 'cv']
Jialin Li's avatar
Jialin Li committed
8
proto_configs = ['vr', 'nopaxos']
9
num_client_configs = [1, 2, 3, 4]
10
experiments = []
11
sync_period = 200
12

13
14
15
link_rate_opt = '--LinkRate=100Gb/s ' # don't forget space at the end
link_latency_opt = '--LinkLatency=500ns '

Jialin Li's avatar
Jialin Li committed
16
17
18
19
20
21
22
for proto_config in proto_configs:
    for num_c in num_client_configs:
        for host_config in host_configs:
            for seq_config in seq_configs:
                for nic_config in nic_configs:
                    e = exp.Experiment(proto_config + '-'  + host_config + '-' + nic_config + '-' + seq_config + f'-{num_c}')
                    net = sim.NS3SequencerNet()
23
                    net.sync_period = sync_period
Jialin Li's avatar
Jialin Li committed
24
25
26
27
28
29
30
31
                    net.opt = link_rate_opt + link_latency_opt
                    e.add_network(net)

                    # host
                    if host_config == 'qemu':
                        host_class = sim.QemuHost
                    elif host_config == 'gt':
                        host_class = sim.Gem5Host
32
                        e.checkpoint = True
Jialin Li's avatar
Jialin Li committed
33
34
                    else:
                        raise NameError(host_config)
35

36
37
38
39
40
41
42
43
44
45
46
47
48
                    # nic
                    if nic_config == 'ib':
                        nic_class = sim.I40eNIC
                        nc_class = node.I40eLinuxNode
                    elif nic_config == 'cb':
                        nic_class = sim.CorundumBMNIC
                        nc_class = node.CorundumLinuxNode
                    elif nic_config == 'cv':
                        nic_class = sim.CorundumVerilatorNIC
                        nc_class = node.CorundumLinuxNode
                    else:
                        raise NameError(nic_config)

Jialin Li's avatar
Jialin Li committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

                    # app
                    if proto_config == 'vr':
                        replica_class = node.VRReplica
                        client_class = node.VRClient
                    elif proto_config == 'nopaxos':
                        replica_class = node.NOPaxosReplica
                        client_class = node.NOPaxosClient
                    else:
                        raise NameError(proto_config)

                    # endhost sequencer
                    if seq_config == 'ehseq' and proto_config == 'nopaxos':
                        sequencer = sim.create_basic_hosts(e, 1, 'sequencer', net, nic_class,
                                host_class, nc_class, node.NOPaxosSequencer, ip_start = 100)
                        sequencer[0].sleep = 1
65
66
                        sequencer[0].node_config.disk_image = 'nopaxos'
                        sequencer[0].nics[0].sync_period = sync_period
67

Jialin Li's avatar
Jialin Li committed
68
69
70
71
72
                    replicas = sim.create_basic_hosts(e, 3, 'replica', net, nic_class,
                            host_class, nc_class, replica_class)
                    for i in range(len(replicas)):
                        replicas[i].node_config.app.index = i
                        replicas[i].sleep = 1
73
74
                        replicas[i].node_config.disk_image = 'nopaxos'
                        replicas[i].nics[0].sync_period = sync_period
75

Jialin Li's avatar
Jialin Li committed
76
77
                    clients = sim.create_basic_hosts(e, num_c, 'client', net, nic_class,
                            host_class, nc_class, client_class, ip_start = 4)
78

Jialin Li's avatar
Jialin Li committed
79
                    for c in clients:
80
                        c.sleep = 5
Jialin Li's avatar
Jialin Li committed
81
                        c.node_config.app.server_ips = ['10.0.0.1', '10.0.0.2', '10.0.0.3']
82
83
                        c.node_config.disk_image = 'nopaxos'
                        c.nics[0].sync_period = sync_period
84

Jialin Li's avatar
Jialin Li committed
85
                    clients[num_c - 1].wait = True
86
                    clients[num_c - 1].node_config.app.is_last = True
87

Jialin Li's avatar
Jialin Li committed
88
89
                    print(e.name)
                    #print (len(experiments))
90

Jialin Li's avatar
Jialin Li committed
91
                    experiments.append(e)
92