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.
Fixed par for code generation and added closeness centrality
- Loading branch information
1 parent
b423546
commit 0ead07d
Showing
6 changed files
with
75 additions
and
73 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
Empty file.
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,64 @@ | ||
element Vertex end | ||
element Edge end | ||
|
||
const edges : edgeset{Edge}(Vertex, Vertex) = load (argv[1]); | ||
const vertices : vertexset{Vertex} = edges.getVertices(); | ||
const checked : vector{Vertex}(int) = -1; | ||
const scores: vector{Vertex}(double) = 0; | ||
|
||
func updateEdge[checked_local: vector{Vertex}(int)](src : Vertex, dst : Vertex) | ||
checked_local[dst] = checked_local[src] + 1; | ||
end | ||
|
||
func toFilter[checked_local: vector{Vertex}(int)](v : Vertex) -> output : bool | ||
output = checked_local[v] == -1; | ||
end | ||
|
||
func main() | ||
startTimer(); | ||
|
||
#l1# par_for i in 0:64 | ||
|
||
var checked_local : vector{Vertex}(int) = -1; | ||
|
||
var start_vertex : int = atoi(argv[2]); | ||
checked_local[start_vertex] = 0; | ||
|
||
var frontier : vertexset{Vertex} = new vertexset{Vertex}(0); | ||
|
||
frontier.addVertex(start_vertex); | ||
|
||
while (frontier.getVertexSetSize() != 0) | ||
|
||
#s1# var output : vertexset{Vertex} = edges.from(frontier).to(toFilter[checked_local]).applyModified(updateEdge[checked_local], checked_local); | ||
delete frontier; | ||
frontier = output; | ||
|
||
end | ||
delete frontier; | ||
|
||
|
||
var notConnected : vertexset{Vertex} = vertices.filter(toFilter[checked_local]); | ||
var amountNotConnected : int = notConnected.getVertexSetSize(); | ||
var sum: int = checked_local.sum(); | ||
sum = sum + amountNotConnected; | ||
|
||
scores[start_vertex] = 1/sum; | ||
|
||
delete checked_local; | ||
end | ||
|
||
var elapsed_time : float = stopTimer(); | ||
print "elapsed time: "; | ||
print elapsed_time; | ||
end | ||
|
||
schedule: | ||
program->configParForGrainSize("l1", 16) | ||
->configParForScheduleType("l1", "static") | ||
->configParForNumThreads("l1", 4); | ||
|
||
program->configApplyDirection("l1:s1", "SparsePush-DensePull") | ||
->configApplyParallelization("l1:s1", "dynamic-vertex-parallel") | ||
->configApplyDenseVertexSet("l1:s1","bitvector", "src-vertexset", "DensePull"); | ||
|
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
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