Repository navigation
Expand file tree
/
Copy pathcp_load
More file actions
executable file
·155 lines (139 loc) · 6.51 KB
/
Copy pathcp_load
File metadata and controls
executable file
·155 lines (139 loc) · 6.51 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/usr/bin/python3
# Copyright (c) 2020-2022 Homa Developers
# SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0+
# This cperf benchmark generates CDFs of short-message latency for Homa
# and TCP under different loads.
# Type "cp_vs_load --help" for documentation.
from cperf import *
parser = get_parser(description=
'Generates CDFS of short message latency as a function of load '
'for Homa and TCP.',
usage='%(prog)s [options]')
parser.add_argument('--dctcp', dest='dctcp', type=boolean,
default=False, help="Boolean value:: true means run measurements "
"on DCTCP (default: false)")
parser.add_argument('-b', '--gpbs', type=float, dest='gbps',
metavar='B', required=True,
help='Maximum bandwidth (Gbits/sec) to generate from each client '
'machine; additional experiments will run at 0.1, 0.2, and 0.5 this '
'value')
parser.add_argument('-w', '--workload', dest='workload',
metavar='W', required = True,
help='Workload to use for benchmark: w1-w5 or number')
options = parser.parse_args()
init(options)
servers = range(0, options.num_nodes)
clients = range(0, options.num_nodes)
fractions = [1.0, 0.5, 0.2, 0.1]
# Run the experiments
if not options.plot_only:
try:
options.protocol = "homa"
start_servers(servers, options)
o = copy.deepcopy(options)
o.gbps = 0.0
o.client_ports = 1
o.client_max = 1
o.server_ports = 1
o.server_nodes = 1
o.first_server = 1
o.unloaded = 500
run_experiment("unloaded_%s" % (options.workload), range(0, 1), o)
for fraction in fractions:
o = copy.deepcopy(options)
o.gbps = options.gbps*fraction/2.0
run_experiment("homa%3.1f_%s" % (fraction, options.workload),
clients, o)
options.protocol = "tcp"
start_servers(servers, options)
for fraction in fractions:
o = copy.deepcopy(options)
o.gbps = options.gbps*fraction/2.0
run_experiment("tcp%3.1f_%s" % (fraction, options.workload),
clients, o)
if options.dctcp:
congestion = get_sysctl_parameter("net.ipv4.tcp_congestion_control")
set_sysctl_parameter("net.ipv4.tcp_congestion_control",
"dctcp", range(0, options.num_nodes))
do_ssh(["sudo", "sysctl",
".net.ipv4.tcp_congestion_control=dctcp"],
range(0, options.num_nodes))
for fraction in fractions:
o = copy.deepcopy(options)
o.gbps = options.gbps*fraction/2.0
run_experiment("dctcp%3.1f_%s" % (fraction, options.workload),
clients, o)
set_sysctl_parameter("net.ipv4.tcp_congestion_control",
congestion, range(0, options.num_nodes))
except Exception as e:
log(traceback.format_exc())
log("Stopping nodes")
stop_nodes()
scan_logs()
# Generate plots and reports
unloaded_exp = "unloaded_%s" % (options.workload)
set_unloaded(unloaded_exp)
# Generate slowdown plot.
log("Generating slowdown plot for %s" % (options.workload))
title = "%s %d nodes, %.2f GB/s" % (options.workload.capitalize(),
options.num_nodes, options.gbps)
ax = start_plot_vs_msg_length(title, 1000, "homa1.0_%s" % (options.workload))
if options.dctcp:
plot_slowdown(ax, "dctcp%3.1f_%s" % (fractions[0], options.workload),
"p99", "DCTCP %4.2f Gbps" % (fractions[0] * options.gbps),
color=dctcp_color)
plot_slowdown(ax, "dctcp%3.1f_%s" % (fractions[1], options.workload),
"p99", "DCTCP %4.2f Gbps" % (fractions[1] * options.gbps),
color=dctcp_color2)
plot_slowdown(ax, "dctcp%3.1f_%s" % (fractions[-1], options.workload),
"p99", "DCTCP %4.2f Gbps" % (fractions[-1] * options.gbps),
color=dctcp_color3)
else:
plot_slowdown(ax, "tcp%3.1f_%s" % (fractions[0], options.workload),
"p99", "TCP %4.2f Gbps" % (fractions[0] * options.gbps),
color=tcp_color)
plot_slowdown(ax, "tcp%3.1f_%s" % (fractions[1], options.workload),
"p99", "TCP %4.2f Gbps" % (fractions[1] * options.gbps),
color=tcp_color2)
plot_slowdown(ax, "tcp%3.1f_%s" % (fractions[-1], options.workload),
"p99", "TCP %4.2f Gbps" % (fractions[-1] * options.gbps),
color=tcp_color3)
plot_slowdown(ax, "homa%3.1f_%s" % (fractions[0], options.workload), "p99",
"Homa %4.2f Gbps" % (fractions[0] * options.gbps), color=homa_color)
plot_slowdown(ax, "homa%3.1f_%s" % (fractions[1], options.workload), "p99",
"Homa %4.2f Gbps" % (fractions[1] * options.gbps), color=homa_color2)
plot_slowdown(ax, "homa%3.1f_%s" % (fractions[-1], options.workload), "p99",
"Homa %4.2f Gbps" % (fractions[-1] * options.gbps), color=homa_color3)
if options.workload == "w5":
ax.legend(loc="upper right", prop={'size': 9})
else:
ax.legend(loc="upper left", prop={'size': 9})
plt.tight_layout()
plt.savefig("%s/reports/slowdown_%s.pdf" % (options.log_dir, options.workload))
# Generate CDF of small-message RTTs.
log("Generating short message CDFs for %s" % (options.workload))
title = "%s %d nodes" % (options.workload.capitalize(), options.num_nodes)
start_cdf_plot(title, 10, 0.99e05, 1e-05, "RTT (usecs)",
"Cumulative Fraction of Short Messages")
set_unloaded("unloaded_%s" % (options.workload))
styles = [(0, (1, 1)), (0, (2, 2)), (0, (5, 2)), "solid"]
if options.dctcp:
for fraction in fractions:
x, y = get_short_cdf("dctcp%3.1f_%s" % (fraction, options.workload))
plt.plot(x, y, label="DCTCP %4.2f Gbps" % (fraction * options.gbps),
color=dctcp_color, linestyle=styles.pop())
else:
for fraction in fractions:
x, y = get_short_cdf("tcp%3.1f_%s" % (fraction, options.workload))
plt.plot(x, y, label="TCP %4.2f Gbps" % (fraction * options.gbps),
color=tcp_color, linestyle=styles.pop())
styles = [(0, (1, 1)), (0, (2, 2)), (0, (5, 2)), "solid"]
for fraction in fractions:
x, y = get_short_cdf("homa%3.1f_%s" % (fraction, options.workload))
plt.plot(x, y, label="Homa %4.2f Gbps" % (fraction * options.gbps),
color=homa_color, linestyle=styles.pop())
x, y = get_short_cdf(unloaded_exp)
plt.plot(x, y, label="Homa best case", color=unloaded_color)
plt.legend(loc="upper right", prop={'size': 9})
plt.savefig("%s/reports/load_cdfs_%s.pdf" % (options.log_dir, options.workload))
# print(plt.rcParams['axes.prop_cycle'].by_key()['color'])