Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 2146926

Browse files
knutwalkerjexp
authored andcommitted
Parallel pagerank (#178)
* Add parallel page rank * Run only 1 warmup/measurement for LDBC benchmark * Allow LightGraph to be run in parallel * Only park for 100 nanos instead of sleep for 100 millis when the queue is full * Avoid allocation of task list, of tasks cannot be run in parallel * Make sure to sync all scores before running a new iteration * Add test for parallel execution only * Reorder LBDC params
1 parent d91d6ea commit 2146926

File tree

13 files changed

+574
-131
lines changed

13 files changed

+574
-131
lines changed

algo/src/main/java/org/neo4j/graphalgo/PageRankProc.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package org.neo4j.graphalgo;
22

3-
import algo.Pools;
43
import org.neo4j.graphalgo.api.Graph;
54
import org.neo4j.graphalgo.api.GraphFactory;
65
import org.neo4j.graphalgo.core.GraphLoader;
76
import org.neo4j.graphalgo.core.ProcedureConfiguration;
8-
import org.neo4j.graphalgo.core.heavyweight.HeavyGraphFactory;
7+
import org.neo4j.graphalgo.core.utils.Pools;
98
import org.neo4j.graphalgo.core.utils.ProgressTimer;
109
import org.neo4j.graphalgo.impl.PageRank;
1110
import org.neo4j.graphalgo.impl.PageRankExporter;
@@ -104,21 +103,25 @@ private double[] evaluate(
104103

105104
double dampingFactor = configuration.get(CONFIG_DAMPING, DEFAULT_DAMPING);
106105
int iterations = configuration.getIterations(DEFAULT_ITERATIONS);
106+
final int batchSize = configuration.getBatchSize();
107107
log.debug("Computing page rank with damping of " + dampingFactor + " and " + iterations + " iterations.");
108-
PageRank pageRankAlgo = new PageRank(
108+
109+
PageRank algo = new PageRank(
110+
Pools.DEFAULT,
111+
batchSize,
109112
graph,
110113
graph,
111114
graph,
112115
graph,
113116
dampingFactor);
114117

115-
statsBuilder.timeEval(() -> pageRankAlgo.compute(iterations));
118+
statsBuilder.timeEval(() -> algo.compute(iterations));
116119

117120
statsBuilder
118121
.withIterations(iterations)
119122
.withDampingFactor(dampingFactor);
120123

121-
return pageRankAlgo.getPageRank();
124+
return algo.getPageRank();
122125
}
123126

124127
private void write(
@@ -130,15 +133,14 @@ private void write(
130133
log.debug("Writing results");
131134
String propertyName = configuration.getWriteProperty(DEFAULT_SCORE_PROPERTY);
132135
int batchSize = configuration.getBatchSize();
133-
statsBuilder.timeWrite(() -> {
134-
new PageRankExporter(
135-
batchSize,
136-
api,
137-
graph,
138-
graph,
139-
propertyName,
140-
Pools.DEFAULT).write(scores);
141-
});
136+
statsBuilder.timeWrite(() -> new PageRankExporter(
137+
batchSize,
138+
api,
139+
graph,
140+
graph,
141+
propertyName,
142+
Pools.DEFAULT)
143+
.write(scores));
142144
statsBuilder
143145
.withWrite(true)
144146
.withProperty(propertyName);

0 commit comments

Comments
 (0)