Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
* [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo
@ 2017-12-09 15:23 Akira Yokosawa
  2017-12-09 15:24 ` [PATCH 2/2] CodeSamples/formal/herd: Make use of absperf scripts in make targets Akira Yokosawa
  2017-12-11 17:07 ` [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo Paul E. McKenney
  0 siblings, 2 replies; 3+ messages in thread
From: Akira Yokosawa @ 2017-12-09 15:23 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From d44f361687f33ef3c293154d94a18571591d97ba Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Fri, 8 Dec 2017 00:11:26 +0900
Subject: [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo

Import scripts as of commit 62d56aa9b4a2 ("Make absperf scripts more
flexible") in Paul's repository at:

    https://github.com/paulmckrcu/litmus.git

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 CodeSamples/formal/herd/absperf-reduce.sh | 30 ++++++++++++++++++++++++++++++
 CodeSamples/formal/herd/absperf.sh        | 15 +++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 CodeSamples/formal/herd/absperf-reduce.sh
 create mode 100644 CodeSamples/formal/herd/absperf.sh

diff --git a/CodeSamples/formal/herd/absperf-reduce.sh b/CodeSamples/formal/herd/absperf-reduce.sh
new file mode 100644
index 0000000..0c338b8
--- /dev/null
+++ b/CodeSamples/formal/herd/absperf-reduce.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+awk '
+/absperf/ {
+	curtest=$1;
+	testran = 0;
+}
+
+/^Test/ {
+	testran = 1;
+}
+
+/maxresident)k/ {
+	if (testran) {
+		curtesttime = $0;
+		gsub(/user .*$/, "", curtesttime);
+		testtime_n[curtest]++;
+		testtime_sum[curtest] += curtesttime;
+		if (testtime_max[curtest] == "" || curtesttime > testtime_max[curtest])
+			testtime_max[curtest] = curtesttime;
+		if (testtime_min[curtest] == "" || curtesttime < testtime_min[curtest])
+			testtime_min[curtest] = curtesttime;
+	}
+}
+
+END {
+	for (i in testtime_n)
+		print i, testtime_sum[i] / testtime_n[i], testtime_min[i], testtime_max[i];
+}
+'
diff --git a/CodeSamples/formal/herd/absperf.sh b/CodeSamples/formal/herd/absperf.sh
new file mode 100644
index 0000000..4b54680
--- /dev/null
+++ b/CodeSamples/formal/herd/absperf.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+TIMECMD=/usr/bin/time
+TESTBASE=${1:-litmus-tests}
+TIMEOUT=${2:-15m}
+ITER=${3:-10}
+
+for n in $(seq $ITER)
+do
+	for i in $TESTBASE/absperf/*.litmus
+	do
+		echo $i
+		$TIMECMD timeout $TIMEOUT herd7 -conf linux-kernel.cfg $i
+	done
+done
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] CodeSamples/formal/herd: Make use of absperf scripts in make targets
  2017-12-09 15:23 [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo Akira Yokosawa
@ 2017-12-09 15:24 ` Akira Yokosawa
  2017-12-11 17:07 ` [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Akira Yokosawa @ 2017-12-09 15:24 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 858319eab17c2b51d17a39ff769b19303292b526 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 10 Dec 2017 00:15:57 +0900
Subject: [PATCH 2/2] CodeSamples/formal/herd: Make use of absperf scripts in make targets

Target "run-absperf" runs 16 of 20 absperf litmus tests whose results
are covered in Table E.2.

Target "run-absperf-all" runs all 20 of the tests.  Long tests should
end up in timeout by default (15m).

Also add target "help".

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 CodeSamples/formal/herd/.gitignore |  2 ++
 CodeSamples/formal/herd/Makefile   | 62 +++++++++++++++++++++++++++++---------
 2 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/CodeSamples/formal/herd/.gitignore b/CodeSamples/formal/herd/.gitignore
index e0ad195..d12c930 100644
--- a/CodeSamples/formal/herd/.gitignore
+++ b/CodeSamples/formal/herd/.gitignore
@@ -1,5 +1,7 @@
 *.out
 *.herd
+*.raw
 klitmus
 klitmus.tar
 memory-model
+absperf
diff --git a/CodeSamples/formal/herd/Makefile b/CodeSamples/formal/herd/Makefile
index b99699b..7bbfeaf 100644
--- a/CodeSamples/formal/herd/Makefile
+++ b/CodeSamples/formal/herd/Makefile
@@ -3,11 +3,17 @@
 # Default target: Transform litmus tests in ../litmus to herd7 compatible format
 #         (remove 2nd {})
 #
-# run-herd7: Examine transformed litmus tests by herd7 with LKMM
+# run-herd7:       Examine transformed litmus tests by herd7 with LKMM
+# cross-klitmus7:  Cross-compile transformed litmus tests by klitmus7
+# run-absperf:     Run memory model benchmark tests of absperf
+# run-absperf-all: Run all absperf tests (including those take quite a while)
 #
-# cross-klitmus7: Cross-compile transformed litmus tests with klitmus7
+# Warning: absperf tests take more than 1 hour by default.
 #
-# run-herd7-bench: Run benchmark tests of herd7 itself
+# Note: Parameters TIMEOUT and ITER in absperf.sh can be overridden by
+#       options to "make".  E.g.:
+#
+#       $ make TIMEOUT=1m ITER=3 run-absperf
 #
 # Note: There need to be a symbolic link "memory-model" under
 #       CodeSamples/formal/herd for herd7 to work.
@@ -33,12 +39,15 @@ KLITMUS7_CMD := $(shell which klitmus7)
 LITMUS7_TEST := $(notdir $(wildcard ../litmus/*.litmus))
 LITMUS7_HERD_TEST := $(addsuffix .herd,$(LITMUS7_TEST))
 LITMUS7_HERD_OUT  := $(addsuffix .out,$(LITMUS7_TEST))
-HERD_BENCH        := $(wildcard C-SB+l-*.litmus)
-HERD_BENCH_LONG   := $(wildcard C-SB+l-o-o-u+l-o-o-u+l-o-o-u+l-o-o-u+l-o-o-u-*.litmus)
-HERD_BENCH_SHORT  := $(filter-out $(HERD_BENCH_LONG),$(HERD_BENCH))
-HERD_BENCH_OUT    := $(addsuffix .out,$(HERD_BENCH_SHORT))
+TIMEOUT = 15m
+ITER    = 10
+ABSPERF_TEST   := $(wildcard C-SB+l-*.litmus)
+ABSPERF_LONG   := $(wildcard C-SB+l-o-o-u+l-o-o-u+l-o-o-u+l-o-o-u+l-o-o-u-*.litmus)
+ABSPERF_SHORT  := $(filter-out $(ABSPERF_LONG),$(ABSPERF_TEST))
+ABSPERF_OUT    = absperf.out absperf-all.out

-.PHONY: all clean litmus2herd run-herd7 run-herd7-bench cross-klitmus
+.PHONY: all clean litmus2herd run-herd7 run-absperf run-absperf-all cross-klitmus
+.PHONY: help

 all: litmus2herd

@@ -48,8 +57,8 @@ $(LITMUS7_HERD_TEST): %.herd: ../litmus/%
 	sh ./litmus2herd.sh $< $@

 run-herd7: $(LITMUS7_HERD_OUT)
-
-run-herd7-bench: $(HERD_BENCH_OUT)
+run-absperf: absperf.out
+run-absperf-all: absperf-all.out

 $(LKMM_LIST):
 	@echo "#####################################################"
@@ -61,13 +70,23 @@ $(LKMM_LIST):
 	@echo "#####################################################"
 	@exit 1

-$(LITMUS7_HERD_OUT) $(HERD_BENCH_OUT): $(LKMM_LIST)
+$(LITMUS7_HERD_OUT) $(ABSPERF_OUT): $(LKMM_LIST)

 $(LITMUS7_HERD_OUT): %.out: %.herd
 	cd $(LKMM_DIR); herd7 -conf linux-kernel.cfg $(HERD_DIR)/$< > $(HERD_DIR)/$@

-$(HERD_BENCH_OUT): %.out: %
-	cd $(LKMM_DIR); herd7 -conf linux-kernel.cfg $(HERD_DIR)/$< > $(HERD_DIR)/$@
+absperf.out: ABSPERF_LIST = $(ABSPERF_SHORT)
+absperf.out: $(ABSPERF_SHORT)
+absperf-all.out: ABSPERF_LIST = $(ABSPERF_TEST)
+absperf-all.out: $(ABSPERF_TEST)
+
+$(ABSPERF_OUT):
+	mkdir -p absperf
+	rm -f absperf/*
+	ln -s -r $(ABSPERF_LIST) absperf/
+	cd $(LKMM_DIR); sh $(HERD_DIR)/absperf.sh $(HERD_DIR) $(TIMEOUT) $(ITER) >$(HERD_DIR)/$@.raw 2>&1
+	cat $@.raw | sh ./absperf-reduce.sh | sed -e 's/^.*absperf\///' \
+		| sort -r | tee $@

 cross-klitmus: klitmus.tar

@@ -76,7 +95,20 @@ klitmus.tar: litmus2herd
 	klitmus7 -o klitmus $(LITMUS7_HERD_TEST)
 	tar cf klitmus.tar ./klitmus

+help:
+	@echo "Default target: Transform litmus tests in ../litmus to herd7 compatible format"
+	@echo "        (remove 2nd {})"
+	@echo
+	@echo "Other targets:"
+	@echo "    run-herd7:       Examine transformed litmus tests by herd7 with LKMM"
+	@echo "    cross-klitmus7:  Cross-compile transformed litmus tests by klitmus7"
+	@echo "    run-absperf:     Run memory model benchmark tests of absperf"
+	@echo "    run-absperf-all: Run all absperf tests (including those take quite a while)"
+	@echo
+	@echo "Warning: absperf tests require more than 1 hour by default."
+	@echo "    Refer to comment in Makefile for instructions to override default setting."
+
 clean:
-	rm -f *.out *.herd
-	rm -rf klitmus
+	rm -f *.out *.herd *.raw
+	rm -rf klitmus absperf
 	rm -f klitmus.tar
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo
  2017-12-09 15:23 [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo Akira Yokosawa
  2017-12-09 15:24 ` [PATCH 2/2] CodeSamples/formal/herd: Make use of absperf scripts in make targets Akira Yokosawa
@ 2017-12-11 17:07 ` Paul E. McKenney
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2017-12-11 17:07 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Sun, Dec 10, 2017 at 12:23:05AM +0900, Akira Yokosawa wrote:
> >From d44f361687f33ef3c293154d94a18571591d97ba Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Fri, 8 Dec 2017 00:11:26 +0900
> Subject: [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo
> 
> Import scripts as of commit 62d56aa9b4a2 ("Make absperf scripts more
> flexible") in Paul's repository at:
> 
>     https://github.com/paulmckrcu/litmus.git
> 
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>

Queued and pushed, thank you!

							Thanx, Paul

> ---
>  CodeSamples/formal/herd/absperf-reduce.sh | 30 ++++++++++++++++++++++++++++++
>  CodeSamples/formal/herd/absperf.sh        | 15 +++++++++++++++
>  2 files changed, 45 insertions(+)
>  create mode 100644 CodeSamples/formal/herd/absperf-reduce.sh
>  create mode 100644 CodeSamples/formal/herd/absperf.sh
> 
> diff --git a/CodeSamples/formal/herd/absperf-reduce.sh b/CodeSamples/formal/herd/absperf-reduce.sh
> new file mode 100644
> index 0000000..0c338b8
> --- /dev/null
> +++ b/CodeSamples/formal/herd/absperf-reduce.sh
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +
> +awk '
> +/absperf/ {
> +	curtest=$1;
> +	testran = 0;
> +}
> +
> +/^Test/ {
> +	testran = 1;
> +}
> +
> +/maxresident)k/ {
> +	if (testran) {
> +		curtesttime = $0;
> +		gsub(/user .*$/, "", curtesttime);
> +		testtime_n[curtest]++;
> +		testtime_sum[curtest] += curtesttime;
> +		if (testtime_max[curtest] == "" || curtesttime > testtime_max[curtest])
> +			testtime_max[curtest] = curtesttime;
> +		if (testtime_min[curtest] == "" || curtesttime < testtime_min[curtest])
> +			testtime_min[curtest] = curtesttime;
> +	}
> +}
> +
> +END {
> +	for (i in testtime_n)
> +		print i, testtime_sum[i] / testtime_n[i], testtime_min[i], testtime_max[i];
> +}
> +'
> diff --git a/CodeSamples/formal/herd/absperf.sh b/CodeSamples/formal/herd/absperf.sh
> new file mode 100644
> index 0000000..4b54680
> --- /dev/null
> +++ b/CodeSamples/formal/herd/absperf.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +TIMECMD=/usr/bin/time
> +TESTBASE=${1:-litmus-tests}
> +TIMEOUT=${2:-15m}
> +ITER=${3:-10}
> +
> +for n in $(seq $ITER)
> +do
> +	for i in $TESTBASE/absperf/*.litmus
> +	do
> +		echo $i
> +		$TIMECMD timeout $TIMEOUT herd7 -conf linux-kernel.cfg $i
> +	done
> +done
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe perfbook" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-11 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-09 15:23 [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo Akira Yokosawa
2017-12-09 15:24 ` [PATCH 2/2] CodeSamples/formal/herd: Make use of absperf scripts in make targets Akira Yokosawa
2017-12-11 17:07 ` [PATCH 1/2] CodeSamples/formal/herd: Import absperf scripts of Paul's litmus repo Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox