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

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

Hejing Li's avatar
Hejing Li committed
29
# iperf UDP test
30
31
32
33
34
35
36
# 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
37
nic_types = ['cv', 'cb', 'ib']
Hejing Li's avatar
Hejing Li committed
38
39
net_types = ['sw', 'br']
app = ['Host']
40

Jonas Kaufmann's avatar
Jonas Kaufmann committed
41
total_rate = 1000  # Mbps
42
43
num_client_max = 8
num_client_step = 2
Hejing Li's avatar
Hejing Li committed
44
num_client_types = [1, 4, 9, 14, 20]
45
46
47
48
49
50
51
52
#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
53
    per_client_rate = int(total_rate / n_client)
54
55
56
57
58
59
    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
60
61
62
63
                e = exp.Experiment(
                    host_type + '-' + nic_type + '-' + net_type + '-Host-' +
                    f'{total_rate}m' + f'-{n_client}'
                )
64
                # network
Hejing Li's avatar
Hejing Li committed
65
                if net_type == 'sw':
66
                    net = sim.SwitchNet()
Hejing Li's avatar
Hejing Li committed
67
                elif net_type == 'br':
68
69
70
71
72
73
74
                    net = sim.NS3BridgeNet()
                else:
                    raise NameError(net_type)
                e.add_network(net)

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

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

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

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

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

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

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

                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
133
                    #c.wait = True
134
135
136
137
138

                print(e.name)

                # add to experiments
                experiments.append(e)