"tests/test_models/test_backbones/test_cylinder3d_backbone.py" did not exist on "afa4479cb70eb3d2627436ac7d9ecbadc2029b54"
homa_simple_ping.py 4.07 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
24
25
26
27
28
29
30
# Copyright 2022 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.
"""
Simple example experiment, which sets up a client and a server host connected
through a switch.

The client pings the server.
"""

from simbricks.orchestration.experiments import Experiment
from simbricks.orchestration.nodeconfig import (
31
    HomaClientNode, HomaServerNode, I40eLinuxNode, IdleHost, PingClient, NodeConfig
Hejing Li's avatar
Hejing Li committed
32
33
34
)
from simbricks.orchestration.simulators import QemuHost, Gem5Host, I40eNIC, SwitchNet

35
36
37
experiments = []
workload = [1,2,3,4,5]
host_types = ['qemu', 'gem5', 'qt']
Hejing Li's avatar
Hejing Li committed
38
39
40
41
protocol = ['tcp', 'dctcp', 'homa']
for p in protocol:
    for  w in workload:
        for host_type in host_types:
Hejing Li's avatar
Hejing Li committed
42

Hejing Li's avatar
Hejing Li committed
43
44
45
46
47
48
            e = Experiment(f'single_{p}_w{w}_{host_type}')
            e.checkpoint = False  # use checkpoint and restore to speed up simulation
            # host
            if host_type == 'qemu':
                HostClass = QemuHost
            elif host_type == 'qt':
Hejing Li's avatar
Hejing Li committed
49

Hejing Li's avatar
Hejing Li committed
50
51
52
53
                def qemu_timing(node_config: NodeConfig):
                    h = QemuHost(node_config)
                    h.sync = True
                    return h
Hejing Li's avatar
Hejing Li committed
54

Hejing Li's avatar
Hejing Li committed
55
56
57
58
59
60
                HostClass = qemu_timing
            elif host_type == 'gem5':
                HostClass = Gem5Host
                e.checkpoint = True
            else:
                raise NameError(host_type)
Hejing Li's avatar
Hejing Li committed
61

Hejing Li's avatar
Hejing Li committed
62
63
64
65
66
67
68
69
70
71
72
            # create client
            client_config = I40eLinuxNode()  # boot Linux with i40e NIC driver
            client_config.disk_image = 'homa'
            client_config.ip = '10.0.0.1'
            client_config.app = HomaClientNode()
            client_config.app.protocol = p
            client = HostClass(client_config)
            # client.sync = False
            client.name = 'client'
            client.wait = True  # wait for client simulator to finish execution
            e.add_host(client)
Hejing Li's avatar
Hejing Li committed
73

Hejing Li's avatar
Hejing Li committed
74
75
76
77
            # attach client's NIC
            client_nic = I40eNIC()
            e.add_nic(client_nic)
            client.add_nic(client_nic)
Hejing Li's avatar
Hejing Li committed
78

Hejing Li's avatar
Hejing Li committed
79
80
81
82
83
84
85
86
87
88
89
            # create server
            server_config = I40eLinuxNode()  # boot Linux with i40e NIC driver
            server_config.disk_image = 'homa'
            server_config.ip = '10.0.0.2'
            server_config.app = HomaServerNode()
            server_config.app.protocol = p
            server = HostClass(server_config)
            # server.sync = False
            server.name = 'server'
            # server.wait = True
            e.add_host(server)
Hejing Li's avatar
Hejing Li committed
90

Hejing Li's avatar
Hejing Li committed
91
92
93
94
            # attach server's NIC
            server_nic = I40eNIC()
            e.add_nic(server_nic)
            server.add_nic(server_nic)
95

Hejing Li's avatar
Hejing Li committed
96
97
98
99
100
            # connect NICs over network
            network = SwitchNet()
            e.add_network(network)
            client_nic.set_network(network)
            server_nic.set_network(network)
101

Hejing Li's avatar
Hejing Li committed
102
103
104
105
106
            # set more interesting link latencies than default
            eth_latency = 500  # 500 us
            network.eth_latency = eth_latency
            client_nic.eth_latency = eth_latency
            server_nic.eth_latency = eth_latency
107

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