netperf_sysconf.py 3.4 KB
Newer Older
Hejing Li's avatar
Hejing Li committed
1

2
3
4
5
from simbricks.orchestration import system
from simbricks.orchestration import simulation as sim
from simbricks.orchestration import instantiation as inst

6
7
8
9
10
11
12
13
14
"""
Netperf Example:
One Client: Host_0, One Server: Host1 connected through a switch
HOST0 -- NIC0 ------ SWITCH ------ NIC1 -- HOST1

This scripts generates the experiments with all the combinations of different execution modes
"""

# host_types = ['qemu', 'gem5', 'qt']
Hejing Li's avatar
Hejing Li committed
15
host_types = ['gem5']
16
nic_types = ['i40e', 'vr']
17
18
19
net_types = ['switch']
experiments = []

Hejing Li's avatar
Hejing Li committed
20
sys = system.System()
21
22

# create a host instance and a NIC instance then install the NIC on the host
Hejing Li's avatar
Hejing Li committed
23
24
25
26
host0 = system.I40ELinuxHost(sys)
pcie0 = system.PCIeHostInterface(host0)
host0.add_if(pcie0)
nic0 = system.IntelI40eNIC(sys)
27
28
nic0_pci = system.PCIeDeviceInterface(nic0)
nic0.add_if(nic0_pci)
Hejing Li's avatar
Hejing Li committed
29
nic0.add_ipv4('10.0.0.1')
Hejing Li's avatar
Hejing Li committed
30
pcichannel0 = system.PCIeChannel(pcie0, nic0._pci_if)
31

Hejing Li's avatar
Hejing Li committed
32
33
34
35
36
# create a host instance and a NIC instance then install the NIC on the host
host1 = system.I40ELinuxHost(sys)
pcie1 = system.PCIeHostInterface(host1)
host1.add_if(pcie0)
nic1 = system.IntelI40eNIC(sys)
37
38
nic1_pci = system.PCIeDeviceInterface(nic1)
nic1.add_if(nic1_pci)
Hejing Li's avatar
Hejing Li committed
39
nic1.add_ipv4('10.0.0.2')
Hejing Li's avatar
Hejing Li committed
40
pcichannel1 = system.PCIeChannel(pcie1, nic1._pci_if)
Hejing Li's avatar
Hejing Li committed
41

Hejing Li's avatar
Hejing Li committed
42
43
44
# create switch and its ports
switch = system.EthSwitch(sys)
netif0 = system.EthInterface(switch)
Hejing Li's avatar
Hejing Li committed
45
switch.add_if(netif0)
Hejing Li's avatar
Hejing Li committed
46
netif1 = system.EthInterface(switch)
Hejing Li's avatar
Hejing Li committed
47
switch.add_if(netif1)
48

49
50
51
52
53
nic0_eth = system.EthInterface(nic0)
nic0.add_if(nic0_eth)
nic1_eth = system.EthInterface(nic1)
nic1.add_if(nic1_eth)

Hejing Li's avatar
Hejing Li committed
54
# create channels and connect the switch to the host nics
Hejing Li's avatar
Hejing Li committed
55
56
ethchannel0 = system.EthChannel(switch.eth_ifs[0], nic0._eth_if)
ethchannel1 = system.EthChannel(switch.eth_ifs[1], nic1._eth_if)
57
58

# configure the software to run on the host
Hejing Li's avatar
Hejing Li committed
59
60
host0.add_app(system.NetperfClient(host0, nic1.ip))
host1.add_app(system.NetperfServer(host1))
61
62
63
64
65
66
67

"""
Execution Config
"""
for host_type in host_types:
    for nic_type in nic_types:
        for net_type in net_types:
68
            e = sim.Simulation(
69
70
71
72
                'n-' + host_type + '-' + nic_type + '-' + net_type
            )
            # Host
            if host_type == 'gem5':
73
                host_sim = sim.Gem5Sim
74
75
76
            elif host_type == 'qemu':

                def qemu_sim(e):
77
                    h = sim.QemuSim(e)
78
79
80
81
82
                    h.sync = False
                    return h
                host_sim = qemu_sim

            elif host_type == 'qt':
83
                host_sim = sim.QemuSim
84
85
            else:
                raise NameError(host_type)
86

87
            # NIC
88
89
            if nic_type == 'i40e':
                nic_sim = sim.I40eNicSim
90
            elif nic_type == 'vr':
91
                nic_sim = sim.CorundumVerilatorNICSim
92
93
94
95
96
            else:
                raise NameError(nic_type)

            # Net
            if net_type == 'switch':
97
                net_sim = sim.SwitchNet
98
99
100
            else:
                raise NameError(net_type)

101
            host_inst0 = host_sim(e)
102
103
            host_inst0.add(host0)

104
            host_inst1 = host_sim(e)
105
106
            host_inst1.add(host1)

107
            nic_inst0 = nic_sim(e)
108
109
            nic_inst0.add(nic0)

110
            nic_inst1 = nic_sim(e)
111
112
            nic_inst1.add(nic1)

113
            net_inst = net_sim(e)
114
115
116
117
            net_inst.add(switch)
            
            print(e.name + "   all simulators:")
            sims = e.all_simulators()
118
119
            for s in sims:
                print(s)
120

Hejing Li's avatar
Hejing Li committed
121
            experiments.append(e)