nopaxos.py 5.85 KB
Newer Older
Antoine Kaufmann's avatar
Antoine Kaufmann committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright 2021 Max Planck Institute for Software Systems, and
# National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

23
24
25
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node
26
from simbricks.simulator_utils import create_basic_hosts
27

28
host_configs = ['qemu', 'gt', 'qt']
29
seq_configs = ['swseq', 'ehseq', 'tofino']
30
nic_configs = ['ib', 'cb', 'cv']
Jialin Li's avatar
Jialin Li committed
31
proto_configs = ['vr', 'nopaxos']
32
num_client_configs = [1, 2, 3, 4, 5, 6, 7, 8, 10, 12]
33
experiments = []
34
sync_period = 200
35

36
37
38
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
39
40
41
42
43
44
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}')
45
46
47
48
                    if seq_config == 'tofino':
                        net = sim.TofinoNet()
                    else:
                        net = sim.NS3SequencerNet()
49
                    net.sync_period = sync_period
Jialin Li's avatar
Jialin Li committed
50
51
52
53
54
55
                    net.opt = link_rate_opt + link_latency_opt
                    e.add_network(net)

                    # host
                    if host_config == 'qemu':
                        host_class = sim.QemuHost
56
                        net.sync = False
Jialin Li's avatar
Jialin Li committed
57
58
                    elif host_config == 'gt':
                        host_class = sim.Gem5Host
59
                        e.checkpoint = True
60
61
62
63
64
65
                    elif host_config == 'qt':
                        def qemu_timing():
                            h = sim.QemuHost()
                            h.sync = True
                            return h
                        host_class = qemu_timing
Jialin Li's avatar
Jialin Li committed
66
67
                    else:
                        raise NameError(host_config)
68

69
70
71
72
73
74
75
76
77
78
79
80
81
                    # 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
82
83
84
85
86
87
88
89
90
91
92
93
94

                    # 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':
95
                        sequencer = create_basic_hosts(e, 1, 'sequencer', net, nic_class,
Jialin Li's avatar
Jialin Li committed
96
97
                                host_class, nc_class, node.NOPaxosSequencer, ip_start = 100)
                        sequencer[0].sleep = 1
98
                        sequencer[0].node_config.disk_image = 'nopaxos'
99
                        sequencer[0].pcidevs[0].sync_period = sync_period
Hejing Li's avatar
Hejing Li committed
100
                        sequencer[0].sync_period = sync_period
101

102
                    replicas = create_basic_hosts(e, 3, 'replica', net, nic_class,
Jialin Li's avatar
Jialin Li committed
103
104
105
106
                            host_class, nc_class, replica_class)
                    for i in range(len(replicas)):
                        replicas[i].node_config.app.index = i
                        replicas[i].sleep = 1
107
                        replicas[i].node_config.disk_image = 'nopaxos'
108
                        replicas[i].pcidevs[0].sync_period = sync_period
Hejing Li's avatar
Hejing Li committed
109
                        replicas[i].sync_period = sync_period
110

111
                    clients = create_basic_hosts(e, num_c, 'client', net, nic_class,
Jialin Li's avatar
Jialin Li committed
112
                            host_class, nc_class, client_class, ip_start = 4)
113

Jialin Li's avatar
Jialin Li committed
114
                    for c in clients:
115
                        c.sleep = 5
Jialin Li's avatar
Jialin Li committed
116
                        c.node_config.app.server_ips = ['10.0.0.1', '10.0.0.2', '10.0.0.3']
Jialin Li's avatar
Jialin Li committed
117
118
119
                        if seq_config == 'ehseq':
                            c.node_config.app.server_ips.append('10.0.0.100')
                            c.node_config.app.use_ehseq = True
120
                        c.node_config.disk_image = 'nopaxos'
121
                        c.pcidevs[0].sync_period = sync_period
Hejing Li's avatar
Hejing Li committed
122
                        c.sync_period = sync_period
123

Jialin Li's avatar
Jialin Li committed
124
                    clients[num_c - 1].wait = True
125
                    clients[num_c - 1].node_config.app.is_last = True
126

Jialin Li's avatar
Jialin Li committed
127
128
                    print(e.name)
                    #print (len(experiments))
129

Jialin Li's avatar
Jialin Li committed
130
                    experiments.append(e)
131