nopaxos.py 6.33 KB
Newer Older
Jialin Li's avatar
Jialin Li committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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.

import simbricks.nodeconfig as node
Jonas Kaufmann's avatar
Jonas Kaufmann committed
24
import simbricks.simulators as sim
Jialin Li's avatar
Jialin Li committed
25
26
from simbricks.simulator_utils import create_basic_hosts

Jonas Kaufmann's avatar
Jonas Kaufmann committed
27
28
import simbricks.experiments as exp

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

Jonas Kaufmann's avatar
Jonas Kaufmann committed
37
link_rate_opt = '--LinkRate=100Gb/s '  # don't forget space at the end
Jialin Li's avatar
Jialin Li committed
38
39
40
41
42
43
44
link_latency_opt = '--LinkLatency=500ns '

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

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

Jialin Li's avatar
Jialin Li committed
66
67
68
69
                        def qemu_timing():
                            h = sim.QemuHost()
                            h.sync = True
                            return h
Jonas Kaufmann's avatar
Jonas Kaufmann committed
70

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

                    # nic
                    if nic_config == 'ib':
77
78
                        NicClass = sim.I40eNIC
                        NcClass = node.I40eLinuxNode
Jialin Li's avatar
Jialin Li committed
79
                    elif nic_config == 'cb':
80
81
                        NicClass = sim.CorundumBMNIC
                        NcClass = node.CorundumLinuxNode
Jialin Li's avatar
Jialin Li committed
82
                    elif nic_config == 'cv':
83
84
                        NicClass = sim.CorundumVerilatorNIC
                        NcClass = node.CorundumLinuxNode
Jialin Li's avatar
Jialin Li committed
85
86
87
88
89
                    else:
                        raise NameError(nic_config)

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

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

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

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

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

                    clients[num_c - 1].wait = True
                    clients[num_c - 1].node_config.app.is_last = True

                    experiments.append(e)