Permalink
Browse files

Tweaks to benchmark infrastructure and docs. Begin to reproduce the s…

…etup for issue testing as well.
  • Loading branch information...
1 parent bd2bffb commit 6c324c79f1ee7fdfe845bbcbb47a917b6be02650 @rrnewton rrnewton committed Nov 26, 2012
View
@@ -2,36 +2,51 @@
# This is just here as a reminder of what to run, or for people whose
# fingers are in the habit of typing "make".
-# Run "make install-all" in the parent directory before using the below:
+# Run "make install" in the parent directory before using the below:
-all: install
-install:
- ./generate_cabal.sh
- cabal install
+ifeq ($(GHC),)
+ GHC=`which ghc`
+endif
+ifeq ($(CABAL),)
+ CABAL= cabal
+endif
+
+all: test
+
+install: monad-par-examples.cabal
+ $(CABAL) install --prefix=`pwd`
clean:
- cabal clean || echo
rm -rf bin *.hi *.o *.exe
+ $(CABAL) clean || echo
distclean: clean
rm -f benchmark.run
# This is a quick test that assumes dependencies are already there.
# TODO -- should probably merge this with 'validate'.
# But right now it's SOO much faster than using cabal that it's nice to have around:
-test: benchmark.run
+test: benchmark.run deps
# Building with no cabal should put the same executables in the same
# places as building with cabal:
SHORTRUN=1 THREADS="1" ./benchmark.run --par --no-cabal +RTS -N
-linValidate: benchmark.run
- SHORTRUN=1 THREADS="1" ./benchmark.run +RTS -N
-
benchmark.run: benchmark.hs
ghc -rtsopts -threaded --make benchmark.hs -o benchmark.run
+monad-par-examples.cabal:
+ ./generate_cabal.sh
+
+deps: monad-par-examples.cabal
+ $(CABAL) install --only-dependencies
+
+
#================================================================================
-# Hacks to build on Windows:
+# Validation / regression testing:
+
+# "Validation" uses cabal-dev for isolation:
+CBLDEV= cabal-dev install -s $(MAINDEVDIR)
+BIN="../cabal-dev/bin/"
# BAD way to check for Windows:
ifeq ($(SYSTEMROOT),)
@@ -42,14 +57,24 @@ else
MAINDEVDIR=..\\cabal-dev
endif
-validate:
- ./generate_cabal.sh
- cabal install --only-dependencies
+validate: monad-par-examples.cabal deps
$(MAKE) $(BUILDCMD)
-CBLDEV= cabal-dev install -s $(MAINDEVDIR)
-BIN="../cabal-dev/bin/"
-# SUFFIX=""
+# This is just like a regular test but with cabal-dev.
+linValidate:
+ $(MAKE) CABAL=$(CBLDEV) test
+
+# --------------------------------------------------
+# Hacks to build on Windows:
+
+# We don' yet have the benchmark script running on Windows. So we do
+# things a bit more manually.
+winValidate: allvers
+ cabal-dev install -s ../cabal-dev/ -fdirect
+ $(MAKE) winhelper SUFFIX="_Trace_threaded.exe"
+ $(MAKE) winhelper SUFFIX="_Direct_threaded.exe"
+ $(MAKE) winhelper SUFFIX="_SMP_threaded.exe"
+ # No way to run Sparks version with this little hack.
tracevers:
$(CBLDEV) -ftrace --program-suffix=_Trace_threaded.exe
@@ -71,14 +96,6 @@ allvers: tracevers directvers smpvers sparksvers
# $(CBLDEV) --only-dependencies
# $(MAKE) -j allvers
-# We don' yet have the benchmark script running on Windows. So we do
-# things a bit more manually.
-winValidate: allvers
- cabal-dev install -s ../cabal-dev/ -fdirect
- $(MAKE) winhelper SUFFIX="_Trace_threaded.exe"
- $(MAKE) winhelper SUFFIX="_Direct_threaded.exe"
- $(MAKE) winhelper SUFFIX="_SMP_threaded.exe"
- # No way to run Sparks version with this little hack.
# TEMP: A cheap way to run everything for a quick test without having to
# rely on the benchmark script.
View
@@ -11,46 +11,43 @@ QUICK START
The easy way to get started is to simply run:
- make
make test
-This will compile all the examples, and then run each of them using the settings:
+This will produce a lot of output. It installs dependencies, then
+builds and runs all examples in a "quick" configuration and in
+parallel.
- SHORTRUN=1 THREADS="1"
-
-This will produce a fair bit of profiling output.
-DETAILS
-=======
+MORE DETAILS
+============
-Each benchmark/test program requires a cabal file. The
-'generate_cabal.sh' script creates these files for you.
+Each benchmark/test can be built directly or through a cabal file.
+'generate_cabal.sh' script creates the cabal file for you:
./generate_cabal.sh
-Once generated 'cabal install' will compile each benchmark.
+Once generated, 'cabal install' will compile and install all
+benchmarks (globally):
cabal install
-
+
+
The benchmarks are now ready to be run.
BENCHMARK SCRIPT
================
-To build the benchmark script the haskell shell scripting module 'HSH'
-is required. Some say this is a dangerous module, so you may want to
-install it using cabal-dev.
-
-TESTING / BENCHMARKING
-======================
+This directory provides benchmarking. We used to run the script
+"benchmark.hs" from source, but now it is highly encouraged to compile
+it (and the Makefile does so).
-This directory provides benchmarking. Ranging from the simple:
+Benchmarking can range from the simple:
- SHORTRUN=1 THREADS="1" ./benchmark.hs
+ SHORTRUN=1 THREADS="1" ./benchmark.run
To the more involved:
- KEEPGOING=1 TRIALS=3 THREADS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16" ./benchmark.hs
+ KEEPGOING=1 TRIALS=3 THREADS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16" ./benchmark.run
Both of the above will populate a file named results_$HOSTNAME.dat.
Typically that will be followed by the following call to file the
@@ -66,7 +63,7 @@ The bechmarking configurations are stored in simple text files. There
are three of them currently [2011.10.13] checked in which are tuned
for different sized runs:
- * benchlist.txt -- desktop version, e.g. 4 core workstation
+ * benchlist.txt -- desktop version, e.g. 4 core workstation
* benchlist_server.txt -- big multicore, e.g. 16-32 core server
* benchlist_laptop.txt -- ~dual processor mobile processor
@@ -94,7 +91,8 @@ It is important that new benchmarks conform to all the conventions.
Here is the recipe:
* Add your benchmark here (single .hs file) or in a subdirectory.
- * If the latter, give it a Makefile (supporting "all" and "clean").
+ * Add an entry to generate_cabal.sh, listing the benchmark and its
+ dependencies.
* Add the benchmark and its input parameters to benchlist.txt, as
well as the _laptop and _server variants.
* Make sure the benchmark runs with no arguments. This is "test"
View
@@ -1,21 +1,24 @@
-
SRC= issue21.hs
-
EXES= $(SRC:.hs=.exe)
.SUFFIXES: .hs .exe
.hs.exe: $< $(SRC)
- ghc --make $< -o $@ -rtsopts -threaded $(GHC_ARGS)
+ ghc --make $< -o $@ -rtsopts -threaded -with-rtsopts -N $(GHC_ARGS)
all: $(EXES)
-# These appear if people do a raw ghc --make.
-# I like to wipe these out for cleanliness:
+test:
+ (cd ../examples; $(MAKE) benchmark.run)
+ BENCHLIST=testlist.txt ../examples/benchmark.run
+
+# These extensionless executables appear if people do a raw ghc
+# --make. I like to wipe these out for cleanliness:
RAWPROGS= $(SRC:.hs=)
clean:
rm -f *~ *.o *.hi $(RAWPROGS) $(EXES)
-
+distclean: clean
+ rm -f results*.dat bench*.log *.bak
View
@@ -0,0 +1 @@
+2089877
View
@@ -22,13 +22,17 @@ import PARSCHED
-- This bug was reported for the Trace scheduler:
-- import Control.Monad.Par.Scheds.Trace
-- import Control.Monad.Par
+
import Control.Monad.Par.Scheds.Direct
+
+-- This is ALSO failing for Adam's meta-par scheduler!
-- import Control.Monad.Par.Meta.SMP (runPar, spawn, get)
#endif
import System.Environment (getArgs)
import Control.DeepSeq
-import GHC.Conc (myThreadId)
+import GHC.Conc (myThreadId, numCapabilities)
+import System.IO (hPutStrLn,stderr)
data M = M !Integer !Integer !Integer !Integer
deriving Show
@@ -53,10 +57,10 @@ main :: IO ()
main = do
args <- getArgs
tid <- myThreadId
- putStrLn$"Beginning benchmark on: "++show tid
+ hPutStrLn stderr$"Beginning benchmark on: "++show tid ++ ", numCapabilities "++show numCapabilities
- let n = case args of
+ let n = case args of
+ -- Default to 10M to trigger the bug.
[] -> 10 * 1000 * 1000
--- [] -> 1 * 1000 * 1000
[s] -> read s
print $ length $ show $ fib n
View
View
View
@@ -0,0 +1,10 @@
+# See ../examples/README.md for format description.
+#
+# This is a list that drives building tests in different configurations.
+#
+# Version: tests 1.0
+#
+# CHANGELOG:
+# 1.0 - initial version
+
+issue21 nested

0 comments on commit 6c324c7

Please sign in to comment.