nopaxos.py 6.49 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
26
import simbricks.orchestration.experiments as exp
import simbricks.orchestration.nodeconfig as node
import simbricks.orchestration.simulators as sim
from simbricks.orchestration.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

Jonas Kaufmann's avatar
Jonas Kaufmann committed
36
link_rate_opt = '--LinkRate=100Gb/s '  # don't forget space at the end
37
38
link_latency_opt = '--LinkLatency=500ns '

Jialin Li's avatar
Jialin Li committed
39
40
41
42
43
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:
Jonas Kaufmann's avatar
Jonas Kaufmann committed
44
45
46
47
                    e = exp.Experiment(
                        proto_config + '-' + host_config + '-' + nic_config +
                        '-' + seq_config + f'-{num_c}'
                    )
48
49
50
51
                    if seq_config == 'tofino':
                        net = sim.TofinoNet()
                    else:
                        net = sim.NS3SequencerNet()
52
                    net.sync_period = sync_period
Jialin Li's avatar
Jialin Li committed
53
54
55
56
57
                    net.opt = link_rate_opt + link_latency_opt
                    e.add_network(net)

                    # host
                    if host_config == 'qemu':
58
                        HostClass = sim.QemuHost
59
                        net.sync = False
Jialin Li's avatar
Jialin Li committed
60
                    elif host_config == 'gt':
61
                        HostClass = sim.Gem5Host
62
                        e.checkpoint = True
63
                    elif host_config == 'qt':
Jonas Kaufmann's avatar
Jonas Kaufmann committed
64

65
66
                        def qemu_timing(node_config: node.NodeConfig):
                            h = sim.QemuHost(node_config)
67
68
                            h.sync = True
                            return h
Jonas Kaufmann's avatar
Jonas Kaufmann committed
69

70
                        HostClass = qemu_timing
Jialin Li's avatar
Jialin Li committed
71
72
                    else:
                        raise NameError(host_config)
73

74
75
                    # nic
                    if nic_config == 'ib':
76
77
                        NicClass = sim.I40eNIC
                        NcClass = node.I40eLinuxNode
78
                    elif nic_config == 'cb':
79
80
                        NicClass = sim.CorundumBMNIC
                        NcClass = node.CorundumLinuxNode
81
                    elif nic_config == 'cv':
82
83
                        NicClass = sim.CorundumVerilatorNIC
                        NcClass = node.CorundumLinuxNode
84
85
86
                    else:
                        raise NameError(nic_config)

Jialin Li's avatar
Jialin Li committed
87
88
                    # app
                    if proto_config == 'vr':
89
90
                        ReplicaClass = node.VRReplica
                        ClientClass = node.VRClient
Jialin Li's avatar
Jialin Li committed
91
                    elif proto_config == 'nopaxos':
92
93
                        ReplicaClass = node.NOPaxosReplica
                        ClientClass = node.NOPaxosClient
Jialin Li's avatar
Jialin Li committed
94
95
96
97
98
                    else:
                        raise NameError(proto_config)

                    # endhost sequencer
                    if seq_config == 'ehseq' and proto_config == 'nopaxos':
Jonas Kaufmann's avatar
Jonas Kaufmann committed
99
100
101
102
103
                        sequencer = create_basic_hosts(
                            e,
                            1,
                            'sequencer',
                            net,
104
105
106
                            NicClass,
                            HostClass,
                            NcClass,
Jonas Kaufmann's avatar
Jonas Kaufmann committed
107
108
109
                            node.NOPaxosSequencer,
                            ip_start=100
                        )
110
                        sequencer[0].node_config.disk_image = 'nopaxos'
111
                        sequencer[0].pcidevs[0].sync_period = sync_period
Hejing Li's avatar
Hejing Li committed
112
                        sequencer[0].sync_period = sync_period
113

Jonas Kaufmann's avatar
Jonas Kaufmann committed
114
115
116
117
118
                    replicas = create_basic_hosts(
                        e,
                        3,
                        'replica',
                        net,
119
120
121
122
                        NicClass,
                        HostClass,
                        NcClass,
                        ReplicaClass
Jonas Kaufmann's avatar
Jonas Kaufmann committed
123
                    )
Jialin Li's avatar
Jialin Li committed
124
125
                    for i in range(len(replicas)):
                        replicas[i].node_config.app.index = i
126
                        replicas[i].node_config.disk_image = 'nopaxos'
127
                        replicas[i].pcidevs[0].sync_period = sync_period
Hejing Li's avatar
Hejing Li committed
128
                        replicas[i].sync_period = sync_period
129

Jonas Kaufmann's avatar
Jonas Kaufmann committed
130
131
132
133
134
                    clients = create_basic_hosts(
                        e,
                        num_c,
                        'client',
                        net,
135
136
137
138
                        NicClass,
                        HostClass,
                        NcClass,
                        ClientClass,
Jonas Kaufmann's avatar
Jonas Kaufmann committed
139
140
                        ip_start=4
                    )
141

Jialin Li's avatar
Jialin Li committed
142
                    for c in clients:
Jonas Kaufmann's avatar
Jonas Kaufmann committed
143
144
145
                        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
146
147
148
                        if seq_config == 'ehseq':
                            c.node_config.app.server_ips.append('10.0.0.100')
                            c.node_config.app.use_ehseq = True
149
                        c.node_config.disk_image = 'nopaxos'
150
                        c.pcidevs[0].sync_period = sync_period
Hejing Li's avatar
Hejing Li committed
151
                        c.sync_period = sync_period
152

Jialin Li's avatar
Jialin Li committed
153
                    clients[num_c - 1].wait = True
154
                    clients[num_c - 1].node_config.app.is_last = True
155

156
                    #print(e.name)
157

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