Skip to content

Commit

Permalink
Merge pull request #8119 from Mats-SX/24-fix-pool
Browse files Browse the repository at this point in the history
2.4 - Fixing the pool sizes
  • Loading branch information
Mats-SX authored Sep 11, 2023
2 parents 816b0d9 + 8c82ff9 commit 2180877
Show file tree
Hide file tree
Showing 177 changed files with 588 additions and 557 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.HdrHistogram.DoubleHistogram;
import org.jetbrains.annotations.NotNull;
import org.neo4j.gds.api.ProcedureReturnColumns;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.ProgressTimer;
import org.neo4j.gds.scaling.LogScaler;
import org.neo4j.gds.scaling.ScalerFactory;
Expand Down Expand Up @@ -95,7 +95,7 @@ private Optional<DoubleHistogram> computeCentralityHistogram() {
return Optional.of(CentralityStatistics.histogram(
nodeCount,
centralityFunction,
Pools.DEFAULT,
DefaultPool.INSTANCE,
concurrency
));
} catch (ArrayIndexOutOfBoundsException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.HdrHistogram.Histogram;
import org.jetbrains.annotations.Nullable;
import org.neo4j.gds.api.ProcedureReturnColumns;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.ProgressTimer;

import java.util.Map;
Expand Down Expand Up @@ -54,7 +54,7 @@ protected AbstractCommunityResultBuilder(
ProcedureReturnColumns returnColumns,
int concurrency
) {
this(returnColumns, Pools.DEFAULT, concurrency);
this(returnColumns, DefaultPool.INSTANCE, concurrency);
}

protected AbstractCommunityResultBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.TestSupport;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -49,7 +49,7 @@ void communitySizes(
var communitySizes = CommunityStatistics.communitySizes(
nodeCount,
communityFunction,
Pools.DEFAULT,
DefaultPool.INSTANCE,
concurrency
);
expectedCommunitySizes.forEach((communityId, expectedSize) -> {
Expand All @@ -72,7 +72,7 @@ void communityCount(
CommunityStatistics.communityCount(
nodeCount,
communityFunction,
Pools.DEFAULT,
DefaultPool.INSTANCE,
concurrency
)
);
Expand All @@ -91,7 +91,7 @@ void communityCountAndHistogram(
var communityCountAndHistogram = CommunityStatistics.communityCountAndHistogram(
nodeCount,
communityFunction,
Pools.DEFAULT,
DefaultPool.INSTANCE,
concurrency
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand Down Expand Up @@ -63,7 +63,7 @@ void normalizes(NodePropertyValues properties, double avg, double[] expected) {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.avg).isEqualTo(avg);
Expand All @@ -81,7 +81,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

var avg = 4.444;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand Down Expand Up @@ -62,7 +62,7 @@ void scale(int nodeCount, NodePropertyValues properties, double l1norm, double[]
nodeCount,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.l1Norm).isEqualTo(l1norm);
Expand All @@ -79,7 +79,7 @@ void avoidsDivByZero() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

for (int i = 0; i < 10; i++) {
Expand All @@ -95,7 +95,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

var l1norm = 40D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand All @@ -53,7 +53,7 @@ void normalizes(NodePropertyValues properties, double euclideanLength, double[]
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.euclideanLength).isEqualTo(euclideanLength);
Expand All @@ -70,7 +70,7 @@ void avoidsDivByZero() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

for (int i = 0; i < 10; i++) {
Expand All @@ -86,7 +86,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

var euclideanLength = 16.124;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;
import org.neo4j.gds.nodeproperties.LongTestPropertyValues;
Expand Down Expand Up @@ -72,7 +72,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

for (int i = 0; i < 5; i++) {
Expand Down
8 changes: 4 additions & 4 deletions algo-common/src/test/java/org/neo4j/gds/scaling/MaxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand Down Expand Up @@ -70,7 +70,7 @@ void scale(int nodeCount, NodePropertyValues properties, double absMax, double[]
nodeCount,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.maxAbs).isEqualTo(absMax);
Expand All @@ -88,7 +88,7 @@ void avoidsDivByZero() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.statistics()).containsExactlyEntriesOf(Map.of("absMax", List.of(0D)));
Expand All @@ -106,7 +106,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);


Expand Down
8 changes: 4 additions & 4 deletions algo-common/src/test/java/org/neo4j/gds/scaling/MeanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand Down Expand Up @@ -57,7 +57,7 @@ void normalizes(NodePropertyValues properties, double avg, double min, double ma
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.avg).isEqualTo(avg);
Expand All @@ -81,7 +81,7 @@ void avoidsDivByZero() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.statistics()).containsExactlyInAnyOrderEntriesOf(Map.of(
Expand All @@ -103,7 +103,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

var avg = 4.444;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand All @@ -53,7 +53,7 @@ void normalizes(NodePropertyValues properties, double min, double max) {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.min).isEqualTo(min);
Expand All @@ -77,7 +77,7 @@ void avoidsDivByZero() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.statistics()).containsExactlyEntriesOf(Map.of(
Expand All @@ -98,7 +98,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.junit.jupiter.api.Test;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand All @@ -39,14 +39,14 @@ void shouldAccumulateStatsCorrectly() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);
var meanScaler2 = (Mean) Mean.buildFrom(CypherMapWrapper.empty()).create(
new DoubleTestPropertyValues(nodeId -> 2 * nodeId),
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

var meanScaler1Stats = meanScaler1.statistics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.api.properties.nodes.NodePropertyValues;
import org.neo4j.gds.core.CypherMapWrapper;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues;

Expand Down Expand Up @@ -56,7 +56,7 @@ void normalizes(NodePropertyValues properties, double avg, double std, double[]
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

assertThat(scaler.avg).isEqualTo(avg);
Expand All @@ -78,7 +78,7 @@ void handlesMissingValue() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

var avg = 4.444;
Expand All @@ -100,7 +100,7 @@ void avoidsDivByZero() {
10,
1,
ProgressTracker.NULL_TRACKER,
Pools.DEFAULT
DefaultPool.INSTANCE
);

for (int i = 0; i < 10; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.neo4j.gds.approxmaxkcut.config.ApproxMaxKCutConfig;
import org.neo4j.gds.collections.haa.HugeAtomicByteArray;
import org.neo4j.gds.collections.haa.HugeAtomicDoubleArray;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.mem.MemoryEstimation;
import org.neo4j.gds.core.utils.mem.MemoryEstimations;
import org.neo4j.gds.core.utils.paged.HugeByteArray;
Expand All @@ -51,7 +51,7 @@ public ApproxMaxKCut build(
CONFIG configuration,
ProgressTracker progressTracker
) {
return new ApproxMaxKCut(graph, Pools.DEFAULT, configuration, progressTracker);
return new ApproxMaxKCut(graph, DefaultPool.INSTANCE, configuration, progressTracker);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.neo4j.gds.GraphAlgorithmFactory;
import org.neo4j.gds.api.Graph;
import org.neo4j.gds.collections.haa.HugeAtomicDoubleArray;
import org.neo4j.gds.core.concurrency.Pools;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.mem.MemoryEstimation;
import org.neo4j.gds.core.utils.mem.MemoryEstimations;
import org.neo4j.gds.core.utils.paged.HugeDoubleArray;
Expand Down Expand Up @@ -66,7 +66,7 @@ public BetweennessCentrality build(
graph,
strategy,
traverserFactory,
Pools.DEFAULT,
DefaultPool.INSTANCE,
configuration.concurrency(),
progressTracker
);
Expand Down
Loading

0 comments on commit 2180877

Please sign in to comment.