dctcp.py 3.72 KB
Newer Older
Hejing Li's avatar
Hejing Li committed
1
2
3
4
5
6
7
8
9
10
11
12
import modes.experiments as exp
import modes.simulators as sim
import modes.nodeconfig as node


# iperf TCP_multi_client test
# naming convention following host-nic-net-app
# host: qemu/gem5-timing
# nic:  cv/cb/ib
# net:  switch/dumbbell/bridge
# app: DCTCPm

Hejing Li's avatar
Hejing Li committed
13
types_of_host = ['qemu', 'qt','gt', 'gO3']
Hejing Li's avatar
Hejing Li committed
14
15
16
types_of_nic = ['cv','cb','ib']
types_of_net = ['dumbbell']
types_of_app = ['DCTCPm']
Hejing Li's avatar
Hejing Li committed
17
types_of_mtu = [1500, 4000, 9000]
Hejing Li's avatar
Hejing Li committed
18
19
20

num_pairs = 2
max_k = 199680
Hejing Li's avatar
Hejing Li committed
21
22
k_step = 8320
#k_step = 16640
Hejing Li's avatar
Hejing Li committed
23
link_rate_opt = '--LinkRate=10Gb/s ' # don't forget space at the end
Hejing Li's avatar
Hejing Li committed
24
link_latency_opt = '--LinkLatency=500ns '
25
26
cpu_freq = '5GHz'
cpu_freq_qemu = '2GHz'
Hejing Li's avatar
Hejing Li committed
27
#mtu = 4000
Hejing Li's avatar
Hejing Li committed
28
sys_clock = '1GHz' # if not set, default 1GHz
Hejing Li's avatar
Hejing Li committed
29
30
31
32
33
34
35
36

ip_start = '192.168.64.1'

experiments = []

# set network sim
net_class = sim.NS3DumbbellNet

Hejing Li's avatar
Hejing Li committed
37
38
39
40
41
42
43
44
45
46
47
for mtu in types_of_mtu:
    for h in types_of_host:
        for c in types_of_nic:
            for k_val in range(0, max_k + 1, k_step):

                net = net_class()
                net.opt = link_rate_opt + link_latency_opt + f'--EcnTh={k_val}'

                e = exp.Experiment( h + '-' + c + '-' + 'dumbbell' + '-' + 'DCTCPm' + f'{k_val}' + f'-{mtu}')
                e.add_network(net)

48
                freq = cpu_freq
Hejing Li's avatar
Hejing Li committed
49
50
51
52
                # host
                if h == 'qemu':
                    host_class = sim.QemuHost
                elif h == 'qt':
53
                    freq = cpu_freq_qemu
Hejing Li's avatar
Hejing Li committed
54
55
56
57
58
59
                    def qemu_timing():
                        h = sim.QemuHost()
                        h.sync = True
                        return h
                    host_class = qemu_timing
                elif h == 'gt':
Hejing Li's avatar
Hejing Li committed
60
61
62
63
64
                    def gem5_timing():
                        h = sim.Gem5Host()
                        #h.sys_clock = sys_clock
                        return h
                    host_class = gem5_timing
Hejing Li's avatar
Hejing Li committed
65
66
                    e.checkpoint = True
                elif h == 'gO3':
Hejing Li's avatar
Hejing Li committed
67
68
69
70
71
72
                    def gem5_o3():
                        h = sim.Gem5Host()
                        h.cpu_type = 'DerivO3CPU' 
                        h.sys_clock = sys_clock
                        return h
                    host_class = gem5_o3    
Hejing Li's avatar
Hejing Li committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
                    e.checkpoint = True
                else:
                    raise NameError(h)

                # nic
                if c == 'ib':
                    nic_class = sim.I40eNIC
                    nc_class = node.I40eDCTCPNode
                elif c == 'cb':
                    nic_class = sim.CorundumBMNIC
                    nc_class = node.CorundumDCTCPNode
                elif c == 'cv':
                    nic_class = sim.CorundumVerilatorNIC
                    nc_class = node.CorundumDCTCPNode
                else:
                    raise NameError(c)


                servers = sim.create_dctcp_hosts(e, num_pairs, 'server', net, nic_class, host_class, 
92
                                                nc_class, node.DctcpServer, freq, mtu)
Hejing Li's avatar
Hejing Li committed
93
                clients = sim.create_dctcp_hosts(e, num_pairs, 'client', net, nic_class, host_class, 
94
                                                nc_class, node.DctcpClient, freq, mtu, ip_start=num_pairs+1)
Hejing Li's avatar
Hejing Li committed
95
96

            
Hejing Li's avatar
Hejing Li committed
97
98
99
100
101
102
103
104
105
106
107
108
109
110
                i = 0
                for cl in clients:
                    cl.node_config.app.server_ip = servers[i].node_config.ip
                    i += 1
                
                # 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.

                # The last client waits for the output printed in other hosts, then cleanup
                clients[num_pairs-1].node_config.app.is_last = True
                clients[num_pairs-1].wait = True

                print(e.name)
                experiments.append(e)
Hejing Li's avatar
Hejing Li committed
111