-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from ashwinktpu/WorkingBranch
Working branch
- Loading branch information
Showing
637 changed files
with
1,751,412 additions
and
1,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
lex.yy.c | ||
src/parser/y.tab.h | ||
.vscode/launch.json | ||
src/parser/Makefile | ||
src/Makefile | ||
src/parser/y.tab.c | ||
.vscode/ | ||
src/finalcode | ||
src/finalcode.exe | ||
src/bin/*.o | ||
*.out | ||
src/bin/ | ||
.history/ | ||
.history/* | ||
../.history/* | ||
StarPlat | ||
StarPlat.exe | ||
debug.txt | ||
dump | ||
To_be_done.txt | ||
.github/ | ||
dump/ | ||
*.starplat | ||
runtests.sh | ||
cudadump/ | ||
testcases/testAMD/* | ||
graphcode/generated_hip/*cc | ||
graphcode/generated_hip/*h | ||
.idea/ | ||
*.o |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
def Compute_PR(g, beta, delta, maxIter): | ||
|
||
num_nodes = g.num_nodes() | ||
g.attachNodeProperty(pageRank=1/num_nodes, pageRank_nxt=0) | ||
iterCount = 0 | ||
|
||
condition = True | ||
while condition: | ||
for v in g.nodes(): | ||
sum = 0.0 | ||
|
||
for nbr in g.nodes_to(v): | ||
sum += g.pageRank[nbr] / g.count_outNbrs(nbr) | ||
|
||
val = (1-delta)/num_nodes + delta*sum | ||
|
||
if g.pageRank[v] >= 0: | ||
diff += g.pageRank[v] - val | ||
else: | ||
diff += val - g.pageRank[v] | ||
|
||
g.pageRank_nxt[v] = val | ||
|
||
g.pageRank = g.pageRank_nxt.copy() | ||
iterCount +=1 | ||
|
||
condition = (diff > beta) and (iterCount < maxIter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from math import inf | ||
from constructs import FixedPointUntil, FixedPoint | ||
|
||
def Compute_SSSP(g, src_node): | ||
g.attachNodeProperty(distance=inf, modified=False, modified_next=False) | ||
g.modified[src_node] = True | ||
g.distance[src_node] = 0 | ||
|
||
# finished = False | ||
|
||
def condition(): | ||
finished = True | ||
for v in g.modified.values(): | ||
finished = finished and (not v) | ||
|
||
return finished | ||
|
||
with FixedPointUntil(condition) as loop: | ||
|
||
def block(): | ||
|
||
for v in filter(lambda node: g.modified[node] == True, g.nodes()): | ||
|
||
# Changed loop to accessing via nodes | ||
for nbr in g.getOutNeighbors(v): | ||
|
||
e = g.get_edge(v, nbr) | ||
|
||
new_distance = g.distance[v] + e.weight | ||
if new_distance < g.distance[nbr]: | ||
|
||
g.distance[nbr] = new_distance | ||
g.modified_next[nbr] = True | ||
|
||
# Making a deep copy | ||
g.modified = g.modified_next.copy() | ||
|
||
g.attachNodeProperty(modified_next=False) | ||
|
||
loop.run(block) | ||
|
||
return g.distance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def Compute_TC(g): | ||
triangle_count = 0 | ||
|
||
for v in g.nodes(): | ||
for u in list(filter(lambda u: u<v, g.neighbors(v))): | ||
for w in list(filter(lambda w: w>v, g.neighbors(v))): | ||
if g.is_an_edge(u,w): | ||
triangle_count += 1 | ||
|
||
return triangle_count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class FixedPoint: | ||
def isFinished(self): | ||
finished = True | ||
for v in self.g.modified.values(): | ||
finished = finished and (not v) | ||
|
||
return finished | ||
|
||
def __init__(self, body, g, finished): | ||
self.finished = finished | ||
self.g = g | ||
self.body = body | ||
|
||
# Define the globals and locals dictionaries for the exec call | ||
exec_globals = {'g': g} | ||
exec_locals = {} | ||
|
||
while not self.finished: | ||
exec(self.body, exec_globals, exec_locals) | ||
self.finished = self.isFinished() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class FixedPointUntil: | ||
def __init__(self, condition): | ||
self.condition = condition | ||
|
||
def __enter__(self): | ||
return self | ||
|
||
def __exit__(self, exc_type, exc_value, traceback): | ||
pass | ||
|
||
def run(self, block): | ||
while not self.condition(): | ||
block() |
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import ast | ||
|
||
class FunctionNamePrinter(ast.NodeVisitor): | ||
def visit_FunctionDef(self, node): | ||
print(f"Function name: {node.name}") | ||
self.generic_visit(node) | ||
|
||
|
||
|
||
class SSSPTransformer(ast.NodeTransformer): | ||
def visit_ | ||
pass | ||
|
||
|
||
with open("SSSP.py") as file: | ||
tree = ast.parse(file.read()) | ||
|
||
print(ast.dump(tree, indent=2)) | ||
visitor = FunctionNamePrinter() | ||
visitor.visit(tree) |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Edge: | ||
def __init__(self): | ||
self.src = None | ||
self.dest = None | ||
self.weight = None | ||
self.id = None | ||
self.dir = None | ||
|
||
|
||
def __repr__(self): | ||
return '<src: {}, dest: {}, weight: {}>'.format(self.src, self.dest, self.weight) | ||
|
Oops, something went wrong.