Browse Source

[barrier] Make the bench use perf instead of PAPI

- Convert barrier bench from papi+PapiHighLevel to perf framework
- Remove papihighlevel submodule
- Simplify Makefile (include moving some of the code in a separate
  script)
rebased_bqv2_avoid_if
Thomas Preud'homme 8 years ago
parent
commit
ee71568981

+ 0
- 3
.gitmodules View File

@@ -1,3 +0,0 @@
1
-[submodule "papihighlevel"]
2
-	path = papihighlevel
3
-	url = ../papihighlevel.git

+ 9
- 17
jikes_write_barrier/Makefile View File

@@ -4,27 +4,19 @@ INCDIR=include
4 4
 LIBDIR=lib
5 5
 SRCDIR=src
6 6
 BINDIR=bin
7
-PAPILIBDIR=lib
8
-PAPIINCDIR=include
9
-LOCALDIR=$(HOME)/local
7
+SCRIPTDIR=scripts
10 8
 
11
-default: barrier
9
+SRCS := $(shell find $(SRCDIR) -name \*.java | sed -r "s@^\./@@")
10
+BINS=$(patsubst $(SRCDIR)/%.java,$(BINDIR)/%.class,$(SRCS))
12 11
 
13
-# TODO: Verify libpapihighlevel.so is uptodate (need a git module)
14
-runbarrier: $(BINDIR)/lip6/jikesrvm/bench/Main.class $(BINDIR)/lip6/jikesrvm/bench/Cell.class
15
-	LD_LIBRARY_PATH=$(LOCALDIR)/$(LIBDIR) \
16
-		rvm -cp $(BINDIR):$(LOCALDIR)/$(LIBDIR) \
17
-		-Djava.library.path=$(LOCALDIR)/$(LIBDIR) \
18
-		-Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main
12
+default: $(BINS)
19 13
 
20
-# TODO: Verify libpapihighlevel.so is uptodate (need a git module)
21
-barrier: $(BINDIR)/lip6/jikesrvm/bench/Main.class
14
+runbarrier: $(BINDIR)/lip6/jikesrvm/bench/Main.class
15
+	$(SCRIPTDIR)/launch_java_bench $(BINDIR) $<
22 16
 
23
-$(BINDIR)/lip6/jikesrvm/bench/Main.class: $(SRCDIR)/lip6/jikesrvm/bench/Main.java \
24
-		$(SRCDIR)/lip6/jikesrvm/bench/Cell.java
25
-	if [ ! -d $(BINDIR) ] ; then mkdir $(BINDIR) ; fi
26
-	javac -d $(BINDIR) -sourcepath $(SRCDIR) -classpath $(LOCALDIR)/$(PAPILIBDIR) \
27
-		$(SRCDIR)/lip6/jikesrvm/bench/Main.java
17
+$(BINDIR)/%.class: $(SRCDIR)/%.java
18
+	mkdir -p $(BINDIR)
19
+	javac -d $(BINDIR) -sourcepath $(SRCDIR) $<
28 20
 
29 21
 clean:
30 22
 

+ 22
- 0
jikes_write_barrier/scripts/launch_java_bench View File

@@ -0,0 +1,22 @@
1
+#!/bin/sh
2
+# First argument: classpath
3
+# Second argument: class file containing main
4
+
5
+classPath="${1%/}"
6
+bin="${2#${classPath}/}"
7
+bin=$(echo ${bin} | sed -r "s@\.class\$@@;s@/@.@g")
8
+
9
+perf stat -r 10 -e cpu-cycles -e L1-dcache-loads -e L1-dcache-stores \
10
+	-e L1-dcache-prefetches -e L1-dcache-load-misses \
11
+	-e L1-dcache-prefetch-misses \
12
+	rvm -cp ${classPath} -Xms2G -Xmx3G -X:processors=1 \
13
+	${bin} 2>&1 # | grep -E "[[:digit:]]  (cycles|L1-dcache-loads|L1-dcache-prefetches|L1-dcache-load-misses|L1-dcache-prefetch-misses)"
14
+
15
+#echo "*** Micro benchmark results ***\n"
16
+#echo "Number of loop: ${nbLoop}"
17
+#echo "Number of writes per loop: ${writesPerLoop}"
18
+
19
+#echo "L1 data cache hits (total / per loop / per write): ${} / ${} / ${}"
20
+#echo "L1 data cache misses (total / per loop / per write): ${} / ${} / ${}"
21
+#echo "Total cycles (total / per loop / per write): ${} / ${} / ${}"
22
+#echo "----------------------------------------"

+ 2
- 18
jikes_write_barrier/src/lip6/jikesrvm/bench/Main.java View File

@@ -2,7 +2,6 @@ package lip6.jikesrvm.bench;
2 2
 
3 3
 import java.util.Random;
4 4
 import lip6.jikesrvm.bench.Cell;
5
-import lip6.microbenchs.PapiHighLevel;
6 5
 
7 6
 public class Main
8 7
 {
@@ -10,11 +9,6 @@ public class Main
10 9
 	private static Random randomInt; // random int to put into the cells
11 10
 	private static Cell head;
12 11
 
13
-	static
14
-	{
15
-		System.loadLibrary("papihighlevel");
16
-	}
17
-
18 12
 	public static void main(String args[])
19 13
 	{
20 14
 		randomInt = new Random(424242424242L);
@@ -36,20 +30,10 @@ public class Main
36 30
 			newCell.setNext(head);
37 31
 			head.setPrev(newCell);
38 32
 		}
39
-		if (PapiHighLevel.initialize_papi() != 0)
40
-		{
41
-			System.err.println("Error while inizializing PAPI");
42
-			java.lang.System.exit(1);
43
-			return;
44
-		}
45 33
 		bubbleSort();
46 34
 		/* Only the 6 store in the if of the bubbleSort call the write barrier */
47
-		if (PapiHighLevel.print_results(6, NB_ELEM) != 0)
48
-		{
49
-			System.err.println("Error while getting results");
50
-			java.lang.System.exit(2);
51
-			return;
52
-		}
35
+		System.out.println("Number of loop: "+ NB_ELEM);
36
+		System.out.println("Number of writes per loop: 6");
53 37
 	}
54 38
 
55 39
 	private static void bubbleSort()

+ 0
- 1
papihighlevel

@@ -1 +0,0 @@
1
-Subproject commit 16449c571f7363d0a6dc8293df8f0aaec40b492a

Loading…
Cancel
Save