scale_host.py 4.55 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
import simbricks.experiments as exp
24
import simbricks.nodeconfig as node
Jonas Kaufmann's avatar
Jonas Kaufmann committed
25
import simbricks.simulators as sim
26
from simbricks.simulator_utils import create_basic_hosts
27

Hejing Li's avatar
Hejing Li committed
28
# iperf UDP test
29
30
31
32
33
34
35
# naming convention following host-nic-net-app
# host: gem5-timing
# nic:  cv/cb/ib
# net:  wire/switch/dumbbell/bridge
# app: UDPs

host_types = ['gt', 'qt', 'qemu']
Jonas Kaufmann's avatar
Jonas Kaufmann committed
36
nic_types = ['cv', 'cb', 'ib']
Hejing Li's avatar
Hejing Li committed
37
38
net_types = ['sw', 'br']
app = ['Host']
39

Jonas Kaufmann's avatar
Jonas Kaufmann committed
40
total_rate = 1000  # Mbps
41
42
num_client_max = 8
num_client_step = 2
Hejing Li's avatar
Hejing Li committed
43
num_client_types = [1, 4, 9, 14, 20]
44
45
46
47
48
49
50
51
#for n in range(1, num_client_max + 1, num_client_step):
#    num_client_types.append(n)
#    print(n)

experiments = []

for n_client in num_client_types:

Jonas Kaufmann's avatar
Jonas Kaufmann committed
52
    per_client_rate = int(total_rate / n_client)
53
54
55
56
57
58
    rate = f'{per_client_rate}m'

    for host_type in host_types:
        for nic_type in nic_types:
            for net_type in net_types:

Jonas Kaufmann's avatar
Jonas Kaufmann committed
59
60
61
62
                e = exp.Experiment(
                    host_type + '-' + nic_type + '-' + net_type + '-Host-' +
                    f'{total_rate}m' + f'-{n_client}'
                )
63
                # network
Hejing Li's avatar
Hejing Li committed
64
                if net_type == 'sw':
65
                    net = sim.SwitchNet()
Hejing Li's avatar
Hejing Li committed
66
                elif net_type == 'br':
67
68
69
70
71
72
73
                    net = sim.NS3BridgeNet()
                else:
                    raise NameError(net_type)
                e.add_network(net)

                # host
                if host_type == 'qemu':
74
                    HostClass = sim.QemuHost
75
                elif host_type == 'qt':
Jonas Kaufmann's avatar
Jonas Kaufmann committed
76

77
78
79
80
                    def qemu_timing():
                        h = sim.QemuHost()
                        h.sync = True
                        return h
Jonas Kaufmann's avatar
Jonas Kaufmann committed
81

82
                    HostClass = qemu_timing
83
                elif host_type == 'gt':
84
                    HostClass = sim.Gem5Host
85
86
87
88
89
90
                    e.checkpoint = True
                else:
                    raise NameError(host_type)

                # nic
                if nic_type == 'ib':
91
92
                    NicClass = sim.I40eNIC
                    NcClass = node.I40eLinuxNode
93
                elif nic_type == 'cb':
94
95
                    NicClass = sim.CorundumBMNIC
                    NcClass = node.CorundumLinuxNode
96
                elif nic_type == 'cv':
97
98
                    NicClass = sim.CorundumVerilatorNIC
                    NcClass = node.CorundumLinuxNode
99
100
101
102
                else:
                    raise NameError(nic_type)

                # create servers and clients
Jonas Kaufmann's avatar
Jonas Kaufmann committed
103
104
105
106
107
                servers = create_basic_hosts(
                    e,
                    1,
                    'server',
                    net,
108
109
110
                    NicClass,
                    HostClass,
                    NcClass,
Jonas Kaufmann's avatar
Jonas Kaufmann committed
111
112
113
114
115
116
117
118
                    node.IperfUDPServer
                )

                clients = create_basic_hosts(
                    e,
                    n_client,
                    'client',
                    net,
119
120
121
                    NicClass,
                    HostClass,
                    NcClass,
Jonas Kaufmann's avatar
Jonas Kaufmann committed
122
123
124
125
126
127
                    node.IperfUDPClient,
                    ip_start=2
                )

                clients[n_client - 1].node_config.app.is_last = True
                clients[n_client - 1].wait = True
128
129
130
131

                for c in clients:
                    c.node_config.app.server_ip = servers[0].node_config.ip
                    c.node_config.app.rate = rate
Hejing Li's avatar
Hejing Li committed
132
                    #c.wait = True
133
134
135
136
137

                print(e.name)

                # add to experiments
                experiments.append(e)