-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensm-cc-conf-gen-optimize.rb
267 lines (229 loc) · 8.08 KB
/
opensm-cc-conf-gen-optimize.rb
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/usr/bin/ruby
# Configuration generator script for IB CC Study
# Perry Huang
#require 'colorize'
if(ARGV[0].to_s == "")
fail("Usage: ./opensm-cc-conf-gen.rb [\# of SL]")
end
$num_SL = ARGV[0].to_i
$current_conf_name = "opensm_hyperion38.conf"
#$current_conf_file = "/etc/opensm.conf"
#$new_conf_file = File.new("opensm_cc.conf", "w")
$new_conf_name = "conf_reoptimize/opensm_cc.conf"
$index = "index_reoptimize"
def generate_cct_simula_optimal()
retval = String.new
num_entries = 128
num_entries.times {|i|
current = ((i ** 2) * 7) / (1.0 * 106 ** 2)
current = current.to_f / 0.218
entry = "3:" + current.to_i.to_s
if(i == 0)
retval = entry
else
retval += ","
retval += entry
end
}
return retval
end
def generate_cct_mellanox_default()
retval = String.new
num_entries = 128
num_entries.times {|i|
current = ((i ** 2) * 7) / (1.0 * 95 ** 2)
current = current.to_f / 0.218
entry = "0:" + current.to_i.to_s
if(i == 0)
retval = entry
else
retval += ","
retval += entry
end
}
return retval
end
def generate_cct_simula_llnl()
retval = String.new
num_entries = 128
num_entries.times {|i|
current = ((i ** 2) * 7) / (1.0 * 106 ** 2)
current = current.to_f / 0.408
entry = "3:" + current.to_i.to_s
if(i == 0)
retval = entry
else
retval += ","
retval += entry
end
}
return retval
end
def generate_cct_mellanox_llnl()
retval = String.new
num_entries = 128
num_entries.times {|i|
current = ((i ** 2) * 7) / (1.0 * 95 ** 2)
current = current.to_f / 0.408
entry = "0:" + current.to_i.to_s
if(i == 0)
retval = entry
else
retval += ","
retval += entry
end
}
return retval
end
def generate_cct_perry()
retval = String.new
num_entries = 150
num_entries.times {|i|
current = 1.01 ** i
entry = "0:" + current.to_i.to_s
if(i == 0)
retval = entry
else
retval += ","
retval += entry
end
}
return retval
end
def create_cc_settings()
options = Hash.new
temp = Array.new
# Congestion control
options["congestion_control"] = "TRUE"
# Key
options["cc_key"] = "0x0000000000000000"
# Max outstanding MADs
options["cc_max_outstanding_mads"] = "500"
# Control map
options["cc_sw_cong_setting_control_map"] = "0x1f"
# Victim mask
options["cc_sw_cong_setting_victim_mask"] = "0x000000000000000000000000000000000000000000000000001ffffffffe"
# Credit mask
options["cc_sw_cong_setting_credit_mask"] = "0x0000000000000000000000000000000000000000000000000000000000000000"
# Threshold
#temp = ["0x1", "0x3", "0x5", "0x7", "0x9", "0xb", "0xd", "0xf"]
temp = ["0x7", "0xf"]
#temp = ["0xf"]
options["cc_sw_cong_setting_threshold"] = temp
# Minimum packet size
options["cc_sw_cong_setting_packet_size"] = "1"
# Credit starvation threshold
options["cc_sw_cong_setting_credit_starvation_threshold"] = "0x00"
# Credit starvation return delay
options["cc_sw_cong_setting_credit_starvation_return_delay"] = "0:0"
# Marking rate
#temp = ["0x0000", "0x0002", "0x0004", "0x0008", "0x000f", "0x0020", "0x0030", "0x0040", "0x0050"]
#temp = ["0x0008", "0x000a", "0x000c", "0x000e", "0x000f", "0x0010", "0x0012" "0x0014", "0x0016", "0x0018", "0x001a", "0x001c", "0x001e", "0x0020"]
temp = ["0x000f"]
options["cc_sw_cong_setting_marking_rate"] = temp
# Port control
options["cc_ca_cong_setting_port_control"] = "0x0001"
# Control map
num_SL_binary = 0b0
$num_SL.times {|i|
num_SL_binary |= 1 << i
}
control_map = "0x%04X" % num_SL_binary
options["cc_ca_cong_setting_control_map"] = control_map
# CCTI_Timer
#temp = ["2", "4", "8", "16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192"]
#temp = ["7000", "8192", "9000", "10000", "16000", "20000", "32000"]
#temp = ["20", "40", "80", "160", "320", "640", "1000", "2000", "4000", "6000", "8000", "10000"]
temp = []
temp << "1"
temp_i = 50
while(temp_i < 2200)
temp << temp_i.to_s
temp_i += 50
end
#temp = ["800", "850", "900", "950", "1000", "1050", "1100", "1150", "1200", "1250", "1300", "1350", "1400", "1450", "1500", "1550", "1600", "1650", "1700", "1750", "1800", "1850", "1900", "1950", "2000", "2050", "2100", "2150", "2200", "2250", "2300"]
$num_SL.times {|i|
options["cc_ca_cong_setting_ccti_timer #{i}"] = temp
}
# CCTI_Increase
$num_SL.times {|i|
options["cc_ca_cong_setting_ccti_increase #{i}"] = "1"
}
# CCTI_Limit
$num_SL.times {|i|
options["cc_ca_cong_setting_trigger_threshold #{i}"] = "1"
}
# CCTI_Min
$num_SL.times {|i|
options["cc_ca_cong_setting_ccti_min #{i}"] = "0"
}
# CCT
#options["cc_cct"] = generate_cct()
#options["cc_cct"] = [generate_cct_mellanox_default(), generate_cct_mellanox_llnl(), generate_cct_simula_optimal(), generate_cct_simula_llnl()]
options["cc_cct"] = [generate_cct_perry()]
return options
end
def print_new_confs(options)
index = File.open($index, "w")
count = 0
#count = options["cc_cct"].count * options["cc_ca_cong_setting_ccti_timer 0"].count * options["cc_sw_cong_setting_marking_rate"].count * options["cc_sw_cong_setting_threshold"].count
cct_table = options["cc_cct"]
cct_table.each {|cct|
options["cc_ca_cong_setting_ccti_timer 0"].each {|timer_0|
options["cc_sw_cong_setting_marking_rate"].each {|marking_rate|
options["cc_sw_cong_setting_threshold"].each {|threshold|
name = String.new
ext = String.new
parts = $new_conf_name.split('.')
name = parts[0]
ext = parts[1]
file_name = name + "#{count}." + ext
`cp #{$current_conf_name} #{file_name}`
puts "copied current conf to conf file #{count}"
new_file = File.open("#{file_name}", "a")
puts "writing CC stuff to conf file #{count}"
new_file.puts "congestion_control #{options["congestion_control"]}"
new_file.puts "cc_key #{options["cc_key"]}"
new_file.puts "cc_max_outstanding_mads #{options["cc_max_outstanding_mads"]}"
new_file.puts "cc_sw_cong_setting_control_map #{options["cc_sw_cong_setting_control_map"]}"
new_file.puts "cc_sw_cong_setting_victim_mask #{options["cc_sw_cong_setting_victim_mask"]}"
new_file.puts "cc_sw_cong_setting_credit_mask #{options["cc_sw_cong_setting_credit_mask"]}"
new_file.puts "cc_sw_cong_setting_threshold #{threshold}"
new_file.puts "cc_sw_cong_setting_packet_size #{options["cc_sw_cong_setting_packet_size"]}"
new_file.puts "cc_sw_cong_setting_credit_starvation_threshold #{options["cc_sw_cong_setting_credit_starvation_threshold"]}"
new_file.puts "cc_sw_cong_setting_credit_starvation_return_delay #{options["cc_sw_cong_setting_credit_starvation_return_delay"]}"
new_file.puts "cc_sw_cong_setting_marking_rate #{marking_rate}"
new_file.puts "cc_ca_cong_setting_port_control #{options["cc_ca_cong_setting_port_control"]}"
new_file.puts "cc_ca_cong_setting_control_map #{options["cc_ca_cong_setting_control_map"]}"
$num_SL.times {|i|
new_file.puts "cc_ca_cong_setting_ccti_timer #{i} #{timer_0}"
new_file.puts "cc_ca_cong_setting_ccti_increase #{i} #{options["cc_ca_cong_setting_ccti_increase #{i}"]}"
new_file.puts "cc_ca_cong_setting_trigger_threshold #{i} #{options["cc_ca_cong_setting_trigger_threshold #{i}"]}"
new_file.puts "cc_ca_cong_setting_ccti_min #{i} #{options["cc_ca_cong_setting_ccti_min #{i}"]}"
}
new_file.puts "cc_cct #{cct}"
index.puts file_name
index.puts "cc_sw_cong_setting_threshold #{threshold}"
index.puts "cc_sw_cong_setting_marking_rate #{marking_rate}"
index.puts "cc_ca_cong_setting_ccti_timer #{timer_0}"
index.puts "cc_ca_cong_setting_ccti_increase #{options["cc_ca_cong_setting_ccti_increase 0"]}"
index.puts "cc_ca_cong_setting_trigger_threshold #{options["cc_ca_cong_setting_trigger_threshold 0"]}"
index.puts "cc_ca_cong_setting_ccti_min #{options["cc_ca_cong_setting_ccti_min 0"]}"
index.puts "cc_cct #{cct}"
index.puts
index.puts "################################"
index.puts
new_file.close
count = count + 1
}
}
}
}
index.close
end
settings = create_cc_settings()
print_new_confs(settings)
#`./opensm --config opensm_cc1.conf`
# call function to generate variance in cc settings
# call function to loop through opensm config, run benchmarks, and run graphing