Skip to content

Commit 11bf39f

Browse files
committed
Code cleanup.
1 parent f5dff90 commit 11bf39f

File tree

4 files changed

+5
-24
lines changed

4 files changed

+5
-24
lines changed

cfpq_add_context/add_contexts.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def to_label_decomposed_graph(graph):
3131
print("Boolean matrix for alloc nvals: ", alloc.nvals)
3232

3333
alloc_r = Matrix(BOOL, graph.ncols, graph.nrows, name = "alloc_r_after_intersection")
34-
#alloc_r << graph.select(graphblas.select.select_alloc_r)
3534
alloc_r << alloc.T
3635
print("Boolean matrix for alloc_r nvals: ", alloc_r.nvals)
3736

@@ -40,8 +39,6 @@ def to_label_decomposed_graph(graph):
4039
print("Boolean matrix for assign nvals: ", assign.nvals)
4140

4241
assign_r = Matrix(BOOL, graph.ncols, graph.nrows, name = "assign_r_after_intersection")
43-
#assign_r << graph.select(graphblas.select.select_assign_r)
44-
#assign_r << assign_r + graph.select(graphblas.select.select_pass_and_return).T
4542
assign_r << assign.T
4643
print("Boolean matrix for assign_r nvals: ", assign_r.nvals)
4744

@@ -51,14 +48,12 @@ def to_label_decomposed_graph(graph):
5148
load_i << graph.select(graphblas.select.select_load).apply(graphblas.unary.decode_load)
5249

5350
load_r_i = Matrix(UINT64, graph.ncols, graph.nrows, name = "load_r_i_after_intersection")
54-
#load_r_i << graph.select(graphblas.select.select_load_r).apply(graphblas.unary.decode_load_r)
5551
load_r_i << load_i.T
5652

5753
store_i = Matrix(UINT64, graph.ncols, graph.nrows, name = "store_i_after_intersection")
5854
store_i << graph.select(graphblas.select.select_store).apply(graphblas.unary.decode_store)
5955

6056
store_r_i = Matrix(UINT64, graph.ncols, graph.nrows, name = "store_r_i_after_intersection")
61-
#store_r_i << graph.select(graphblas.select.select_store_r).apply(graphblas.unary.decode_store_r)
6257
store_r_i << store_i.T
6358

6459
store_block_count = store_i.reduce_scalar("max").get(0) + 1

cfpq_add_context/intersection.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,7 @@ def intersection (graph, automata) :
6666

6767
#print_matrix_to_dot(intersection, "kron.dot")
6868

69-
#entrypoints = Vector(bool,graph.nrows, name="entrypoints")
70-
#entrypoints << graph.select(graphblas.select.select_not_reversed).reduce_columnwise(graphblas.monoid.lor)
71-
#entrypoints = set(range(0,graph.nrows)).difference(entrypoints.to_coo(values=False)[0])
72-
73-
#print("entypoints:", entrypoints)
74-
75-
sources = [i * automata.nrows for i in range(0,graph.nrows)]
76-
#sources = [i * automata.nrows for i in entrypoints]
77-
69+
sources = [i * automata.nrows for i in range(0, graph.nrows)]
7870

7971
reachable_vertices_mask = bfs(intersection, sources).diag(name="reachable_vertices_mask")
8072

@@ -84,7 +76,7 @@ def intersection (graph, automata) :
8476
unreachable_vertices_removing_end = time.perf_counter()
8577
print("Removing of unreachable vertices done in ", unreachable_vertices_removing_end - zeroes_removing_from_intersection_end)
8678

87-
print_matrix_to_dot(result, "kron_filtered.dot")
79+
#print_matrix_to_dot(result, "kron_filtered.dot")
8880
return result
8981

9082

cfpq_add_context/load_graph.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ def get_raw_edge(line):
5252

5353
with open (file_path,'r') as file:
5454
raw_edges = [get_raw_edge(line) for line in file if len(line.strip()) > 0 and not("_r") in line]
55-
#nvertices = 0
56-
#for (_from, _to, line) in raw_edges:
57-
# _max = max(_from,_to)
58-
# nvertices = max(nvertices, _max)
5955

6056
nvertices = nvertices + 1
6157

@@ -75,8 +71,6 @@ def get_raw_edge(line):
7571
edges[(v_from, v_to)] = get_edge_lbl(terminal)
7672

7773
edges = [(i[0],i[1],edges[i]) for i in edges]
78-
#TODO Remove dup_op! It is a hack to avoid edges duplication.
79-
#result = Matrix.from_edgelist(edges, dtype=UINT64, nrows=nvertices + 1, ncols=nvertices + 1, name="graph",dup_op="max")
8074

8175
result = Matrix.from_edgelist(edges, dtype=UINT64, nrows=nvertices, ncols=nvertices, name="graph")
8276
#print_matrix_to_dot(result, "graph.dot")

cfpq_cli/run_all_pairs_cflr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def run_all_pairs_cflr(
4040
res = algo.solve(graph=graph, grammar=grammar, settings=settings)
4141
if add_contexts:
4242
res = normalize(res, initial_graph_nvertices)
43-
if not ((len(expected_path) > 0) and (verify(res, expected_path))):
44-
print("Incorrect result !!!")
43+
if (len(expected_path) > 0) and not (verify(res, expected_path)):
44+
print("!!! Incorrect result !!!")
4545
finish = time()
46-
print("result: ", res)
46+
#print("result: ", res)
4747
print(f"AnalysisTime\t{finish - start}")
4848
print(f"#SEdges\t{res.nvals}")
4949
if out_path is not None:

0 commit comments

Comments
 (0)