From 9d563ce16be9414ea8b29981f287082b0ac62e7a Mon Sep 17 00:00:00 2001 From: yeom Date: Tue, 27 Jul 2010 01:10:35 +0000 Subject: [PATCH] final version of the merge sort benchmark. --- .../Benchmarks/oooJava/mergesort/BMergeSort4.java | 15 +++++++++++---- .../Benchmarks/oooJava/mergesort/MergeSort.java | 13 ++++++------- Robust/src/Benchmarks/oooJava/mergesort/makefile | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Robust/src/Benchmarks/oooJava/mergesort/BMergeSort4.java b/Robust/src/Benchmarks/oooJava/mergesort/BMergeSort4.java index 74983e95..254df675 100644 --- a/Robust/src/Benchmarks/oooJava/mergesort/BMergeSort4.java +++ b/Robust/src/Benchmarks/oooJava/mergesort/BMergeSort4.java @@ -6,11 +6,15 @@ public class MergeSort4 extends MergeSort { public static void main(String[] args) { int problemSize = 4194304; + int parallelBranch=32; if (args.length > 0) { problemSize = Integer.parseInt(args[0]); } + if (args.length > 1) { + parallelBranch = Integer.parseInt(args[1]); + } MergeSort4 sort = new MergeSort4(); - sort.run(problemSize); + sort.run(problemSize,parallelBranch); } public MergeSort4() { @@ -19,11 +23,14 @@ public class MergeSort4 extends MergeSort { public void runWorkAndTest() { sese run{ + long startT=System.currentTimeMillis(); int output[]=sort(input, 0, input.length); + long endT=System.currentTimeMillis(); + System.out.println("running time="+(endT-startT)); } - sese test{ - checkSorted(output); - } +// sese test{ +// checkSorted(output); +// } } public int[] serializedSort(int A[], int low, int high) { diff --git a/Robust/src/Benchmarks/oooJava/mergesort/MergeSort.java b/Robust/src/Benchmarks/oooJava/mergesort/MergeSort.java index 755cfbfd..8301df61 100644 --- a/Robust/src/Benchmarks/oooJava/mergesort/MergeSort.java +++ b/Robust/src/Benchmarks/oooJava/mergesort/MergeSort.java @@ -28,10 +28,9 @@ public class MergeSort { protected int[] result; protected int size; - public void run(int size) { - this.size = size; + public void run(int size, int branchSize) { long startT = System.currentTimeMillis(); - initialize(); + initialize(size, branchSize); System.out.println("init time=" + (System.currentTimeMillis() - startT)); runWorkAndTest(); } @@ -42,9 +41,9 @@ public class MergeSort { INSERTION_SIZE = 2000; } - public void initialize() { - - SERIALIZED_CUT_OFF = size / 32; + public void initialize(int size, int branchSize) { + this.size = size; + SERIALIZED_CUT_OFF = size / branchSize; input = new int[size]; result = new int[size]; @@ -231,7 +230,7 @@ public class MergeSort { } - quickSort(arr, lo, left + 1); + quickSort(arr, lo, left); quickSort(arr, left + 1, hi); } diff --git a/Robust/src/Benchmarks/oooJava/mergesort/makefile b/Robust/src/Benchmarks/oooJava/mergesort/makefile index c97479b5..6da9451e 100644 --- a/Robust/src/Benchmarks/oooJava/mergesort/makefile +++ b/Robust/src/Benchmarks/oooJava/mergesort/makefile @@ -1,7 +1,7 @@ #raytracer PROGRAM=MergeSort4 -SOURCE_FILES=MergeSort4.java +SOURCE_FILES=BMergeSort4.java BUILDSCRIPT=../../../buildscript @@ -15,7 +15,7 @@ default: $(BUILDSCRIPT) -nojava $(USEOOO) $(BSFLAGS) $(DISJOINT) -o $(PROGRAM)p $(SOURCE_FILES) -builddir par single: - $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM)s -builddir sing $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) -thread -o $(PROGRAM)s -builddir sing $(SOURCE_FILES) ooo: $(BUILDSCRIPT) $(USEOOO) $(BSFLAGS) $(DISJOINT) -o $(PROGRAM)p -builddir par $(SOURCE_FILES) -- 2.34.1