forked from GraphIt-DSL/graphit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adidng an autotuner test file for ppsp
- Loading branch information
1 parent
396f5d1
commit 64a0e42
Showing
1 changed file
with
34 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
element Vertex end | ||
element Edge end | ||
const edges : edgeset{Edge}(Vertex,Vertex, int) = load (argv[1]); | ||
const vertices : vertexset{Vertex} = edges.getVertices(); | ||
const dist : vector{Vertex}(int) = 2147483647; %should be INT_MAX | ||
const pq: priority_queue{Vertex}(int); | ||
|
||
func updateEdge(src : Vertex, dst : Vertex, weight : int) | ||
var new_dist : int = dist[src] + weight; | ||
pq.updatePriorityMin(dst, dist[dst], new_dist); | ||
end | ||
|
||
func reset(v: Vertex) | ||
dist[v] = 2147483647; | ||
end | ||
|
||
func main() | ||
for trail in 0:10 | ||
startTimer(); | ||
vertices.apply(reset); | ||
var start_vertex : int = 10; | ||
var end_vertex : int = 10000; | ||
dist[start_vertex] = 0; | ||
pq = new priority_queue{Vertex}(int)(false, false, dist, 1, 2, false, start_vertex); | ||
while (pq.finishedNode(end_vertex) == false) | ||
var frontier : vertexset{Vertex} = pq.dequeue_ready_set(); % dequeue lowest priority nodes | ||
#s1# edges.from(frontier).applyUpdatePriority(updateEdge); | ||
delete frontier; | ||
end | ||
var elapsed_time : float = stopTimer(); | ||
print "elapsed time: "; | ||
print elapsed_time; | ||
end | ||
end |