diff --git a/charts/bfs_time_vs_size_advanced.png b/charts/bfs_time_vs_size_advanced.png new file mode 100644 index 0000000..bb3c200 Binary files /dev/null and b/charts/bfs_time_vs_size_advanced.png differ diff --git a/charts/bfs_time_vs_size_advanced_normal.png b/charts/bfs_time_vs_size_advanced_normal.png new file mode 100644 index 0000000..cbc1efa Binary files /dev/null and b/charts/bfs_time_vs_size_advanced_normal.png differ diff --git a/charts/bfs_time_vs_threads_advanced.png b/charts/bfs_time_vs_threads_advanced.png new file mode 100644 index 0000000..a00ad3d Binary files /dev/null and b/charts/bfs_time_vs_threads_advanced.png differ diff --git a/charts/bfs_time_vs_threads_advanced_normal.png b/charts/bfs_time_vs_threads_advanced_normal.png new file mode 100644 index 0000000..a46c2ba Binary files /dev/null and b/charts/bfs_time_vs_threads_advanced_normal.png differ diff --git a/plot_bfs_performance.py b/plot_bfs_performance.py new file mode 100644 index 0000000..2e8755d --- /dev/null +++ b/plot_bfs_performance.py @@ -0,0 +1,43 @@ +import pandas as pd +import matplotlib.pyplot as plt +import seaborn as sns + +# Читаем CSV +df = pd.read_csv("tmp/results.csv") + +# --- График 1: Serial vs Parallel (разные потоки) --- +plt.figure(figsize=(12,6)) + +serial_df = df[df['Type'] == 'Serial'] +parallel_df = df[df['Type'] == 'Parallel'] +threads = sorted(parallel_df['Threads'].unique()) + +plt.plot(serial_df['Vertices'], serial_df['Time_ms'], label='Serial BFS', marker='o', linewidth=2, color='black') + +for t in threads: + t_df = parallel_df[parallel_df['Threads'] == t] + plt.plot(t_df['Vertices'], t_df['Time_ms'], marker='o', linestyle='--', label=f'Parallel BFS ({t} threads)') + +plt.xlabel('Number of vertices') +plt.ylabel('Time (ms)') +plt.title('BFS Performance: Serial vs Parallel') +plt.legend() +plt.grid(True) +plt.savefig('bfs_time_vs_size_advanced.png') +plt.show() + + +# --- График 2: Влияние числа потоков на время Parallel BFS --- +plt.figure(figsize=(12,6)) +max_v = 50000 +parallel_maxv = parallel_df[parallel_df['Vertices'] == 50000] +plt.plot(parallel_maxv['Threads'], parallel_maxv['Time_ms'], marker='o', linestyle='-', color='red') +plt.xlabel('Number of threads') +plt.ylabel('Time (ms)') +plt.title(f'Parallel BFS Scaling with Number of Threads (V={max_v})') +plt.xticks(parallel_maxv['Threads']) +plt.grid(True) +plt.savefig('bfs_time_vs_threads_advanced.png') +plt.show() + + diff --git a/results/index.html b/results/index.html new file mode 100644 index 0000000..c3b206c --- /dev/null +++ b/results/index.html @@ -0,0 +1,135 @@ + + + +Java Concurrency Stress test report + + + + + + + + +
+

+50% +

+ + + + +
 
 
Overall pass rate: 1/2 
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
java.specification.nameJava Platform API Specification
java.specification.vendorOracle Corporation
java.specification.version11
java.vendorHomebrew
java.version11.0.27
java.vm.nameOpenJDK 64-Bit Server VM
java.vm.vendorHomebrew
java.vm.version11.0.27+0
os.archaarch64
os.nameMac OS X
os.version15.7.1
+
+
+

FAILED tests

+

Strong asserts were violated. Correct implementations should have no assert failures here.

+ + + + + + + +
   org.itmo.IncorrectParallelBFSStressTest104FAILED
+
+
+

ERROR tests

+

Tests break for some reason, other than failing the assert. Correct implementations should have none.

+ +
+None! +
+
+
+

INTERESTING tests

+

Some interesting behaviors observed. This is for the plain curiosity.

+ +
+None! +
+
+
+

All tests

+

+ + + + + + + + + + + + + +
   org.itmo.IncorrectParallelBFSStressTest104FAILED
   org.itmo.ParallelBFSStressTest104PASSED
+
+ + diff --git a/results/org.itmo.IncorrectParallelBFSStressTest.html b/results/org.itmo.IncorrectParallelBFSStressTest.html new file mode 100644 index 0000000..0dd0fe6 --- /dev/null +++ b/results/org.itmo.IncorrectParallelBFSStressTest.html @@ -0,0 +1,221 @@ + + + +Java Concurrency Stress test report + + + +

org.itmo.IncorrectParallelBFSStressTest

+

Description and references

+

null

+

Environment

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
java.specification.nameJava Platform API Specification
java.specification.vendorOracle Corporation
java.specification.version11
java.vendorHomebrew
java.version11.0.27
java.vm.nameOpenJDK 64-Bit Server VM
java.vm.vendorHomebrew
java.vm.version11.0.27+0
os.archaarch64
os.nameMac OS X
os.version15.7.1
+

Results

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Compilation ModeScheduling ClassJava OptionsStatusObserved States
falsetrue
ForbiddenAcceptable
Race detected, incorrect BFS resultCorrect traversal
split
+    bfsActor: Interpreter
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking]
+
FAILED142338
split
+    bfsActor: Interpreter
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+
FAILED142264
split
+    bfsActor: C1
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking]
+
FAILED132339
split
+    bfsActor: C1
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+
FAILED102675
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking]
+
FAILED132265
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking, -XX:+StressLCM, -XX:+StressGCM]
+
FAILED9912401
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+
FAILED122673
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking, -XX:+StressLCM, -XX:+StressGCM]
+
FAILED6911284
+

Messages

+

VM Output Streams

+

VM Error Streams

+

+

split
+    bfsActor: Interpreter
+
+
    bfsActor: package group free, core group free
+
+ +
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+

+
+
+
+ + + diff --git a/results/org.itmo.ParallelBFSStressTest.html b/results/org.itmo.ParallelBFSStressTest.html new file mode 100644 index 0000000..af5f8b1 --- /dev/null +++ b/results/org.itmo.ParallelBFSStressTest.html @@ -0,0 +1,197 @@ + + + +Java Concurrency Stress test report + + + +

org.itmo.ParallelBFSStressTest

+

Description and references

+

null

+

Environment

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
java.specification.nameJava Platform API Specification
java.specification.vendorOracle Corporation
java.specification.version11
java.vendorHomebrew
java.version11.0.27
java.vm.nameOpenJDK 64-Bit Server VM
java.vm.vendorHomebrew
java.vm.version11.0.27+0
os.archaarch64
os.nameMac OS X
os.version15.7.1
+

Results

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Compilation ModeScheduling ClassJava OptionsStatusObserved States
true
Acceptable
Correct traversal
split
+    bfsActor: Interpreter
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking]
+
OK2204
split
+    bfsActor: Interpreter
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+
OK2315
split
+    bfsActor: C1
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking]
+
OK2278
split
+    bfsActor: C1
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+
OK2278
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking]
+
OK2204
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:+UseBiasedLocking, -XX:+StressLCM, -XX:+StressGCM]
+
OK11575
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking]
+
OK2278
split
+    bfsActor: C2
+
    bfsActor: package group free, core group free
+
+
[-Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=ru, -Duser.variant, -XX:-UseBiasedLocking, -XX:+StressLCM, -XX:+StressGCM]
+
OK11427
+

Messages

+

VM Output Streams

+

VM Error Streams

+ + diff --git a/src/main/java/org/itmo/Graph.java b/src/main/java/org/itmo/Graph.java index 141a0b6..586b06b 100644 --- a/src/main/java/org/itmo/Graph.java +++ b/src/main/java/org/itmo/Graph.java @@ -1,9 +1,13 @@ package org.itmo; import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicIntegerArray; class Graph { private final int V; @@ -23,7 +27,145 @@ void addEdge(int src, int dest) { } } - void parallelBFS(int startVertex) { + AtomicIntegerArray parallelBFS(int startVertex, ExecutorService threadPool, int parallelLevel) { + AtomicIntegerArray visited = new AtomicIntegerArray(V); + visited.set(startVertex, 1); + + // list of vertices on the current level + List frontier = new ArrayList<>(); + frontier.add(startVertex); + + while (!frontier.isEmpty()) { + int tasks = Math.min(frontier.size(), parallelLevel); + int verticesByTask = (int) Math.ceil((double) frontier.size() / tasks);; + List nextFrontier = new ArrayList<>(); + + List>> futures = new ArrayList<>(); + for (int task = 0; task < tasks; task++) { + int from = task * verticesByTask; + // exclusive + int to = Math.min(frontier.size(), from + verticesByTask); + + Future> future = threadPool.submit(createVertexProcessingTask(frontier, from, to, visited)); + futures.add(future); + } + + completeFutures(futures, nextFrontier); + frontier = nextFrontier; + } + return visited; + } + + private void completeFutures(List>> futures, List nextFrontier) { + for (Future> future : futures) { + try { + List nextFrontierPart = future.get(10, TimeUnit.SECONDS); + nextFrontier.addAll(nextFrontierPart); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + cancelAllFutures(futures); + throw new RuntimeException("Thread interrupted while processing vertex", e); + } catch (ExecutionException e) { + System.err.println(); + throw new RuntimeException("Unexpected execution error during vertex processing", e); + } catch (TimeoutException e) { + throw new RuntimeException("Vertex processing timeout. Result is not available", e); + } + } + } + + private void cancelAllFutures(List>> futures) { + futures.forEach(future -> future.cancel(true)); + } + + public void printGraph() { + System.out.println("Graph adjacency list:"); + for (int i = 0; i < V; i++) { + System.out.print(i + " -> "); + for (int v : adjList[i]) { + System.out.print(v + " "); + } + System.out.println(); + } + } + + private Callable> createVertexProcessingTask(List frontier, int from, int to, AtomicIntegerArray visited) { + return () -> { + List neighbourVertices = new ArrayList<>(); + for (int i = from; i < to; i++) { + Integer vertex = frontier.get(i); + for (int v : adjList[vertex]) { + if (visited.get(v) == 0 && visited.compareAndSet(v, 0, 1)) { + neighbourVertices.add(v); + } + } + } + return neighbourVertices; + }; + } + + // ----------------------------------------------------- + // INCORRECT + // ----------------------------------------------------- + + boolean[] incorrectParallelBFS(int startVertex, ExecutorService threadPool, int parallelLevel) { + boolean[] visited = new boolean[V]; + visited[startVertex] = true; + + // list of vertices on the current level + List frontier = new ArrayList<>(); + frontier.add(startVertex); + + while (!frontier.isEmpty()) { + int tasks = Math.min(frontier.size(), parallelLevel); + int verticesByTask = (int) Math.ceil((double) frontier.size() / tasks);; + List nextFrontier = new ArrayList<>(); + + List> futures = new ArrayList<>(); + for (int task = 0; task < tasks; task++) { + int from = task * verticesByTask; + // exclusive + int to = Math.min(frontier.size(), from + verticesByTask); + + Future future = threadPool.submit(createIncorrectVertexProcessingTask(frontier, nextFrontier, from, to, visited)); + futures.add(future); + } + + completeFutures(futures); + frontier = nextFrontier; + } + return visited; + } + + private void completeFutures(List> futures) { + for (Future future : futures) { + try { + future.get(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + futures.forEach(f -> f.cancel(true)); + throw new RuntimeException("Thread interrupted while processing vertex", e); + } catch (ExecutionException e) { + System.err.println(); + throw new RuntimeException("Unexpected execution error during vertex processing", e); + } catch (TimeoutException e) { + throw new RuntimeException("Vertex processing timeout. Result is not available", e); + } + } + } + + private Runnable createIncorrectVertexProcessingTask(List frontier, List nextFrontier, int from, int to, boolean[] visited) { + return () -> { + for (int i = from; i < to; i++) { + Integer vertex = frontier.get(i); + for (int v : adjList[vertex]) { + if (!visited[v]) { + visited[v] = true; + nextFrontier.add(v); + } + } + } + }; } //Generated by ChatGPT @@ -47,4 +189,27 @@ void bfs(int startVertex) { } } + Set computeReachableFromZero() { + boolean[] visited = new boolean[V]; + Queue q = new LinkedList<>(); + q.add(0); + visited[0] = true; + + while (!q.isEmpty()) { + int u = q.poll(); + for (int v : adjList[u]) { + if (!visited[v]) { + visited[v] = true; + q.add(v); + } + } + } + + Set reachable = new HashSet<>(); + for (int i = 0; i < V; i++) { + if (visited[i]) reachable.add(i); + } + return reachable; + } + } diff --git a/src/test/java/org/itmo/BFSTest.java b/src/test/java/org/itmo/BFSTest.java index 7bf9098..8428007 100644 --- a/src/test/java/org/itmo/BFSTest.java +++ b/src/test/java/org/itmo/BFSTest.java @@ -4,37 +4,50 @@ import java.io.FileWriter; import java.io.IOException; -import java.nio.Buffer; -import java.util.HashSet; import java.util.Random; -import java.util.function.BiFunction; -import java.util.stream.IntStream; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class BFSTest { @Test public void bfsTest() throws IOException { - int[] sizes = new int[]{10, 100, 1000, 10_000, 10_000, 50_000, 100_000, 1_000_000, 2_000_000}; - int[] connections = new int[]{50, 500, 5000, 50_000, 100_000, 1_000_000, 1_000_000, 10_000_000, 10_000_000}; + int[] sizes = new int[]{10, 100, 1000, 10_000, 10_000, 50_000, 100_000, 1_000_000, 1_500_000, 2_000_000}; + int[] connections = new int[]{50, 500, 5000, 50_000, 100_000, 1_000_000, 1_000_000, 10_000_000, 10_000_000, 10_000_000}; + int[] threadCounts = new int[]{1, 2, 4, 8, 12, 16}; + Random r = new Random(42); - try (FileWriter fw = new FileWriter("tmp/results.txt")) { + + try (FileWriter fw = new FileWriter("tmp/results.csv")) { + fw.append("Vertices,Edges,Threads,Time_ms,Type\n"); // заголовок + for (int i = 0; i < sizes.length; i++) { + int V = sizes[i]; + int E = connections[i]; System.out.println("--------------------------"); - System.out.println("Generating graph of size " + sizes[i] + " ...wait"); - Graph g = new RandomGraphGenerator().generateGraph(r, sizes[i], connections[i]); - System.out.println("Generation completed!\nStarting bfs"); + System.out.println("Generating graph: V=" + V + ", E=" + E + " ..."); + Graph g = new RandomGraphGenerator().generateGraph(r, V, E); + System.out.println("Graph generated. Starting BFS measurements..."); + + // Последовательный BFS long serialTime = executeSerialBfsAndGetTime(g); - long parallelTime = executeParallelBfsAndGetTime(g); - fw.append("Times for " + sizes[i] + " vertices and " + connections[i] + " connections: "); - fw.append("\nSerial: " + serialTime); - fw.append("\nParallel: " + parallelTime); - fw.append("\n--------\n"); + System.out.println("Serial BFS time: " + serialTime + " ms"); + fw.append(V + "," + E + ",1," + serialTime + ",Serial\n"); + + // Параллельный BFS с разным числом потоков + for (int threads : threadCounts) { + ExecutorService pool = Executors.newFixedThreadPool(threads); + long parallelTime = executeParallelBfsAndGetTime(g, pool, threads); + pool.shutdown(); + System.out.println("Parallel BFS (" + threads + " threads): " + parallelTime + " ms"); + fw.append(V + "," + E + "," + threads + "," + parallelTime + ",Parallel\n"); + } + + fw.flush(); } - fw.flush(); } } - private long executeSerialBfsAndGetTime(Graph g) { long startTime = System.currentTimeMillis(); g.bfs(0); @@ -42,11 +55,10 @@ private long executeSerialBfsAndGetTime(Graph g) { return endTime - startTime; } - private long executeParallelBfsAndGetTime(Graph g) { + private long executeParallelBfsAndGetTime(Graph g, ExecutorService pool, int parallelLevel) { long startTime = System.currentTimeMillis(); - g.parallelBFS(0); + g.parallelBFS(0, pool, parallelLevel); long endTime = System.currentTimeMillis(); return endTime - startTime; } - } diff --git a/src/test/java/org/itmo/IncorrectParallelBFSStressTest.java b/src/test/java/org/itmo/IncorrectParallelBFSStressTest.java new file mode 100644 index 0000000..ca4a473 --- /dev/null +++ b/src/test/java/org/itmo/IncorrectParallelBFSStressTest.java @@ -0,0 +1,35 @@ +package org.itmo; + +import org.openjdk.jcstress.annotations.*; +import org.openjdk.jcstress.infra.results.Z_Result; + +import java.util.*; +import java.util.concurrent.*; + +@JCStressTest +@Outcome(id = "true", expect = Expect.ACCEPTABLE, desc = "Correct traversal") +@Outcome(id = "false", expect = Expect.FORBIDDEN, desc = "Race detected, incorrect BFS result") +@State +public class IncorrectParallelBFSStressTest { + private static final int V = 20; + private static final int E = 30; + private final Graph g = new RandomGraphGenerator().generateGraph(new Random(42), V, E); + private final ExecutorService pool = Executors.newFixedThreadPool(4); + + @Actor + public void bfsActor(Z_Result r) { + boolean[] res = g.incorrectParallelBFS(0, pool, 4); + Set reachable = g.computeReachableFromZero(); + + int cnt = 0; + for (int i = 0; i < res.length; i++) { + cnt += res[i] ? 1 : 0; + } + r.r1 = cnt == reachable.size(); + } + + @Arbiter + public void arbiter() { + pool.shutdownNow(); + } +} diff --git a/src/test/java/org/itmo/ParallelBFSStressTest.java b/src/test/java/org/itmo/ParallelBFSStressTest.java new file mode 100644 index 0000000..090809a --- /dev/null +++ b/src/test/java/org/itmo/ParallelBFSStressTest.java @@ -0,0 +1,36 @@ +package org.itmo; + +import org.openjdk.jcstress.annotations.*; +import org.openjdk.jcstress.infra.results.Z_Result; + +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicIntegerArray; + +@JCStressTest +@Outcome(id = "true", expect = Expect.ACCEPTABLE, desc = "Correct traversal") +@Outcome(id = "false", expect = Expect.FORBIDDEN, desc = "Race detected, incorrect BFS result") +@State +public class ParallelBFSStressTest { + private static final int V = 20; + private static final int E = 30; + private final Graph g = new RandomGraphGenerator().generateGraph(new Random(42), V, E); + private final ExecutorService pool = Executors.newFixedThreadPool(4); + + @Actor + public void bfsActor(Z_Result r) { + AtomicIntegerArray res = g.parallelBFS(0, pool, 4); + Set reachable = g.computeReachableFromZero(); + + int cnt = 0; + for (int i = 0; i < res.length(); i++) { + cnt += res.get(i); + } + r.r1 = cnt == reachable.size(); + } + + @Arbiter + public void arbiter() { + pool.shutdownNow(); + } +} diff --git a/src/test/java/org/itmo/RandomGraphGenerator.java b/src/test/java/org/itmo/RandomGraphGenerator.java index 1a57226..ceedf3f 100644 --- a/src/test/java/org/itmo/RandomGraphGenerator.java +++ b/src/test/java/org/itmo/RandomGraphGenerator.java @@ -9,6 +9,7 @@ import java.util.stream.IntStream; public class RandomGraphGenerator { + private static final int PARALLEL_LEVEL = 4; private long pack(int u, int v) { return (((long) u) << 32) | (v & 0xffffffffL); diff --git a/tmp/results.csv b/tmp/results.csv new file mode 100644 index 0000000..70f9d17 --- /dev/null +++ b/tmp/results.csv @@ -0,0 +1,80 @@ +Vertices,Edges,Threads,Time_ms,Type +10,50,1,0,Serial +10,50,1,1,Parallel +10,50,2,1,Parallel +10,50,4,1,Parallel +10,50,8,3,Parallel +10,50,12,1,Parallel +10,50,16,1,Parallel + +100,500,1,0,Serial +100,500,1,0,Parallel +100,500,2,0,Parallel +100,500,4,1,Parallel +100,500,8,1,Parallel +100,500,12,1,Parallel +100,500,16,1,Parallel + +1000,5000,1,1,Serial +1000,5000,1,0,Parallel +1000,5000,2,1,Parallel +1000,5000,4,1,Parallel +1000,5000,8,1,Parallel +1000,5000,12,2,Parallel +1000,5000,16,2,Parallel + +10000,50000,1,3,Serial +10000,50000,1,2,Parallel +10000,50000,2,5,Parallel +10000,50000,4,5,Parallel +10000,50000,8,1,Parallel +10000,50000,12,1,Parallel +10000,50000,16,1,Parallel + +10000,100000,1,2,Serial +10000,100000,1,3,Parallel +10000,100000,2,1,Parallel +10000,100000,4,1,Parallel +10000,100000,8,1,Parallel +10000,100000,12,1,Parallel +10000,100000,16,1,Parallel + +50000,1000000,1,22,Serial +50000,1000000,1,19,Parallel +50000,1000000,2,9,Parallel +50000,1000000,4,6,Parallel +50000,1000000,8,4,Parallel +50000,1000000,12,5,Parallel +50000,1000000,16,4,Parallel + +100000,1000000,1,21,Serial +100000,1000000,1,29,Parallel +100000,1000000,2,14,Parallel +100000,1000000,4,8,Parallel +100000,1000000,8,4,Parallel +100000,1000000,12,30,Parallel +100000,1000000,16,3,Parallel + +1000000,10000000,1,710,Serial +1000000,10000000,1,394,Parallel +1000000,10000000,2,195,Parallel +1000000,10000000,4,100,Parallel +1000000,10000000,8,54,Parallel +1000000,10000000,12,54,Parallel +1000000,10000000,16,54,Parallel + +1500000,10000000,1,841,Serial +1500000,10000000,1,898,Parallel +1500000,10000000,2,625,Parallel +1500000,10000000,4,502,Parallel +1500000,10000000,8,853,Parallel +1500000,10000000,12,454,Parallel +1500000,10000000,16,438,Parallel + +2000000,10000000,1,1423,Serial +2000000,10000000,1,1018,Parallel +2000000,10000000,2,1370,Parallel +2000000,10000000,4,1090,Parallel +2000000,10000000,8,1130,Parallel +2000000,10000000,12,1008,Parallel +2000000,10000000,16,989,Parallel diff --git a/tmp/results.txt b/tmp/results.txt index 027e7f9..b67cb24 100644 --- a/tmp/results.txt +++ b/tmp/results.txt @@ -1,32 +1,36 @@ Times for 10 vertices and 50 connections: Serial: 0 -Parallel: 0 +Parallel: 3 -------- Times for 100 vertices and 500 connections: Serial: 0 -Parallel: 0 +Parallel: 1 -------- Times for 1000 vertices and 5000 connections: Serial: 1 -Parallel: 0 +Parallel: 1 -------- Times for 10000 vertices and 50000 connections: Serial: 3 -Parallel: 0 +Parallel: 4 -------- Times for 10000 vertices and 100000 connections: Serial: 2 -Parallel: 0 +Parallel: 7 -------- Times for 50000 vertices and 1000000 connections: -Serial: 30 -Parallel: 0 +Serial: 12 +Parallel: 19 -------- Times for 100000 vertices and 1000000 connections: -Serial: 18 -Parallel: 0 +Serial: 15 +Parallel: 7 -------- Times for 1000000 vertices and 10000000 connections: -Serial: 307 -Parallel: 0 +Serial: 309 +Parallel: 596 -------- +Times for 2000000 vertices and 10000000 connections: +Serial: 1453 +Parallel: 1134 +-------- \ No newline at end of file