Skip to content

Commit 05354f7

Browse files
committed
comments added!
1 parent 08ba81a commit 05354f7

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

metric/tub.py

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77

88
def get_throughput_upper_bound(topo, tor_list, demand_dict):
9+
""" Computes the throughput upper bound (tub)
10+
11+
Args:
12+
topo: a networkx graph representing switch connections
13+
tor_list: contains list of switches with directly connected servers
14+
demand_dict: a mapping from each ToR to its number of directly connected servers
15+
16+
Returns:
17+
tub: throughput upper bound
18+
"""
919
print("** Computing maximal permutation traffic matrix...")
1020
_, sum_weight_matching = near_wc_tm.get_longest_matching_traffic_matrix(topo, tor_list, demand_dict)
1121
print("** Computing TUB...")

topo_repo/topology.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def get_avg_path_between_src_dst(self, tor_list=None):
4141
return shortest_path.all_pair_shortest_path_length_adjacency_matrix(self.get_topology(), tor_list)
4242

4343
def get_near_worst_case_traffic_matrix(self):
44-
return near_wc_tm.get_longest_matching_traffic_matrix_igraph_implementation(self.get_topology(),
45-
self.get_tor_list(),
46-
self.get_demand_dict())
44+
return near_wc_tm.get_longest_matching_traffic_matrix(self.get_topology(),
45+
self.get_tor_list(),
46+
self.get_demand_dict())
4747

4848
def get_tub(self):
4949
return tub.get_throughput_upper_bound(self.get_topology(), self.get_tor_list(), self.get_demand_dict())

utils/near_wc_tm.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@
1313
def get_longest_matching_traffic_matrix(topology, tor_list, demand_dict):
1414
""" Generates maximal permutation traffic matrix that results in near worst-case throughput
1515
16-
This is a generalization to: Measuring and Understanding Throughput of Network Topologies
17-
(Sangeetha Abdu Jyothi, Ankit Singla, P. Brighten Godfrey, Alexandra Kolla), 2016
16+
This is a generalization to: Measuring and Understanding Throughput of Network Topologies
17+
(Sangeetha Abdu Jyothi, Ankit Singla, P. Brighten Godfrey, Alexandra Kolla), 2016
1818
19-
Args:
20-
topology: a networkx graph representing switch connections
21-
tor_list: contains list of switches with directly connected servers
22-
demand_dict: a mapping from each ToR to its number of directly connected servers
23-
Returns:
24-
traffic_matrix: a dictionary (src, dst) --> amount of traffic
25-
sum_weight_matching: sum shortest_path_length(src, dst) * traffic_matrix(src, dst) over all pairs
26-
traffic_matrix
19+
Args:
20+
topology: a networkx graph representing switch connections
21+
tor_list: contains list of switches with directly connected servers
22+
demand_dict: a mapping from each ToR to its number of directly connected servers
23+
Returns:
24+
traffic_matrix: a dictionary (src, dst) --> amount of traffic
25+
sum_weight_matching: sum shortest_path_length(src, dst) * traffic_matrix(src, dst) over all pairs
26+
traffic_matrix
2727
"""
2828

29+
# Line 30-36 makes sure the order of ToRs in the tor_list is the same as their order in the topology.nodes().
2930
initial_tor_list = list(tor_list)
3031
num_nodes = len(tor_list)
3132
tor_list = list()
@@ -49,7 +50,6 @@ def get_longest_matching_traffic_matrix(topology, tor_list, demand_dict):
4950
del coefficient
5051
del minimum
5152
gc.collect()
52-
# bi_graph.es["weights"] = weights
5353

5454
print("**** Computing maximum weighted matching...")
5555
maximal_matching = bi_graph.maximum_bipartite_matching(weights=weights, eps=0.001)

utils/shortest_path.py

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def sum_all_pair_shortest_path_length_adjacency_matrix(g):
2424
C = np.zeros(np.shape(A), order='F', dtype=np.float32)
2525
for k in range(num_node - 1):
2626
B = scipy.linalg.blas.sgemm(1, B, A)
27-
# B = np.matmul(B, A)
2827
C = np.add(C, B)
2928
num = np.count_nonzero(C == 0)
3029
if num == 0:

utils/utilities.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def get_model(filename):
11-
print("** Loading Topology...")
11+
print("** Loading Model...")
1212
with open(filename, "rb") as file:
1313
if sys.version_info >= (3, 0):
1414
model = pickle.load(file, encoding="latin1")
@@ -23,6 +23,7 @@ def delete_file(file_path):
2323

2424

2525
def store_model(model, file_path):
26+
print("** Storing Model...")
2627
delete_file(file_path)
2728
with open(file_path, "wb") as f:
2829
pickle.dump(model, f)

0 commit comments

Comments
 (0)