f1_dctcp.py 5.87 KB
Newer Older
Hejing Li's avatar
Hejing 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.
"""
This script is for reproducing Simbricks line in [Figure 1] DCTCP result.
Jonas Kaufmann's avatar
Jonas Kaufmann committed
24

Hejing Li's avatar
Hejing Li committed
25
26
27
28
29
We used following combination of simulators.
HOST: Gem5 timing CPU
NIC: Intel i40e behavioral model
NET: ns-3 dumbbell model

Jonas Kaufmann's avatar
Jonas Kaufmann committed
30
The simulation composed of two pairs of iperf server and client, connected
Hejing Li's avatar
Hejing Li committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
in a dumbbell topology.
The link between two switches is the bottleneck link.

 [HOST_0]-[NIC_0]-----[SWITCH]---[SWITCH]-----[NIC_1]-[HOST_1]
  server_0                |        |                client_0
                          |        |
 [HOST_0]-[NIC_0]----------        ---------- [NIC_1]-[HOST_1]
   server_1                                          client_1

The command to run all the experiments is:
$: python3 run.py pyexps/ae/f1_dctcp.py --filter gt-ib-* --force --verbose
"""

import simbricks.nodeconfig as node
Jonas Kaufmann's avatar
Jonas Kaufmann committed
45
import simbricks.simulators as sim
Hejing Li's avatar
Hejing Li committed
46
47
from simbricks.simulator_utils import create_dctcp_hosts

Jonas Kaufmann's avatar
Jonas Kaufmann committed
48
49
import simbricks.experiments as exp

Hejing Li's avatar
Hejing Li committed
50
51
52
53
54
55
56
57
58
types_of_host = ['gt']
types_of_nic = ['ib']
types_of_net = ['dumbbell']
types_of_app = ['DCTCPm']
types_of_mtu = [4000]

num_pairs = 2
max_k = 199680
k_step = 16640
Jonas Kaufmann's avatar
Jonas Kaufmann committed
59
link_rate_opt = '--LinkRate=10Gb/s '  # don't forget space at the end
Hejing Li's avatar
Hejing Li committed
60
61
62
link_latency_opt = '--LinkLatency=500ns '
cpu_freq = '5GHz'
cpu_freq_qemu = '2GHz'
Jonas Kaufmann's avatar
Jonas Kaufmann committed
63
sys_clock = '1GHz'  # if not set, default 1GHz
Hejing Li's avatar
Hejing Li committed
64
65
66
67
68
69

ip_start = '192.168.64.1'

experiments = []

# set network sim
70
NetClass = sim.NS3DumbbellNet
Hejing Li's avatar
Hejing Li committed
71
72

for mtu in types_of_mtu:
73
74
    for host in types_of_host:
        for nic in types_of_nic:
Hejing Li's avatar
Hejing Li committed
75
76
            for k_val in range(0, max_k + 1, k_step):

77
                net = NetClass()
Hejing Li's avatar
Hejing Li committed
78
79
                net.opt = link_rate_opt + link_latency_opt + f'--EcnTh={k_val}'

Jonas Kaufmann's avatar
Jonas Kaufmann committed
80
                e = exp.Experiment(
81
                    host + '-' + nic + '-' + 'dumbbell' + '-' + 'DCTCPm' +
Jonas Kaufmann's avatar
Jonas Kaufmann committed
82
83
                    f'{k_val}' + f'-{mtu}'
                )
Hejing Li's avatar
Hejing Li committed
84
85
86
87
                e.add_network(net)

                freq = cpu_freq
                # host
88
89
90
                if host == 'qemu':
                    HostClass = sim.QemuHost
                elif host == 'qt':
Hejing Li's avatar
Hejing Li committed
91
                    freq = cpu_freq_qemu
Jonas Kaufmann's avatar
Jonas Kaufmann committed
92

Hejing Li's avatar
Hejing Li committed
93
94
95
96
                    def qemu_timing():
                        h = sim.QemuHost()
                        h.sync = True
                        return h
Jonas Kaufmann's avatar
Jonas Kaufmann committed
97

98
99
                    HostClass = qemu_timing
                elif host == 'gt':
Jonas Kaufmann's avatar
Jonas Kaufmann committed
100

Hejing Li's avatar
Hejing Li committed
101
102
103
104
                    def gem5_timing():
                        h = sim.Gem5Host()
                        #h.sys_clock = sys_clock
                        return h
Jonas Kaufmann's avatar
Jonas Kaufmann committed
105

106
                    HostClass = gem5_timing
Hejing Li's avatar
Hejing Li committed
107
                    e.checkpoint = True
108
                elif host == 'gO3':
Jonas Kaufmann's avatar
Jonas Kaufmann committed
109

Hejing Li's avatar
Hejing Li committed
110
111
                    def gem5_o3():
                        h = sim.Gem5Host()
Jonas Kaufmann's avatar
Jonas Kaufmann committed
112
                        h.cpu_type = 'DerivO3CPU'
Hejing Li's avatar
Hejing Li committed
113
114
                        h.sys_clock = sys_clock
                        return h
Jonas Kaufmann's avatar
Jonas Kaufmann committed
115

116
                    HostClass = gem5_o3
Hejing Li's avatar
Hejing Li committed
117
118
                    e.checkpoint = True
                else:
119
                    raise NameError(host)
Hejing Li's avatar
Hejing Li committed
120
121

                # nic
122
123
124
125
126
127
128
129
130
                if nic == 'ib':
                    NicClass = sim.I40eNIC
                    NcClass = node.I40eDCTCPNode
                elif nic == 'cb':
                    NicClass = sim.CorundumBMNIC
                    NcClass = node.CorundumDCTCPNode
                elif nic == 'cv':
                    NicClass = sim.CorundumVerilatorNIC
                    NcClass = node.CorundumDCTCPNode
Hejing Li's avatar
Hejing Li committed
131
                else:
132
                    raise NameError(nic)
Hejing Li's avatar
Hejing Li committed
133

Jonas Kaufmann's avatar
Jonas Kaufmann committed
134
135
136
137
138
                servers = create_dctcp_hosts(
                    e,
                    num_pairs,
                    'server',
                    net,
139
140
141
                    NicClass,
                    HostClass,
                    NcClass,
Jonas Kaufmann's avatar
Jonas Kaufmann committed
142
143
144
145
146
147
148
149
150
                    node.DctcpServer,
                    freq,
                    mtu
                )
                clients = create_dctcp_hosts(
                    e,
                    num_pairs,
                    'client',
                    net,
151
152
153
                    NicClass,
                    HostClass,
                    NcClass,
Jonas Kaufmann's avatar
Jonas Kaufmann committed
154
155
156
157
158
                    node.DctcpClient,
                    freq,
                    mtu,
                    ip_start=num_pairs + 1
                )
Hejing Li's avatar
Hejing Li committed
159
160
161
162
163

                i = 0
                for cl in clients:
                    cl.node_config.app.server_ip = servers[i].node_config.ip
                    i += 1
Jonas Kaufmann's avatar
Jonas Kaufmann committed
164

165
166
167
                # All the clients will not poweroff after finishing iperf test
                # except the last one This is to prevent the simulation gets
                # stuck when one of host exits.
Hejing Li's avatar
Hejing Li committed
168

169
170
                # The last client waits for the output printed in other hosts,
                # then cleanup
Jonas Kaufmann's avatar
Jonas Kaufmann committed
171
172
                clients[num_pairs - 1].node_config.app.is_last = True
                clients[num_pairs - 1].wait = True
Hejing Li's avatar
Hejing Li committed
173
174
175

                print(e.name)
                experiments.append(e)