dph-examples: reorganise and cleanup directory structure
authorBen Lippmeier <benl@ouroborus.net>
Tue, 22 Nov 2011 07:14:55 +0000 (18:14 +1100)
committerBen Lippmeier <benl@ouroborus.net>
Tue, 22 Nov 2011 07:14:55 +0000 (18:14 +1100)
also enable -dcore-lint for all examples.

77 files changed:
dph-examples/Makefile
dph-examples/README [new file with mode: 0644]
dph-examples/broken/Tree/Solver.hs [new file with mode: 0644]
dph-examples/dph-examples.cabal
dph-examples/dph-examples.template
dph-examples/examples/imaginary/Primes/Main.hs [moved from dph-examples/imaginary/Primes/Main.hs with 94% similarity]
dph-examples/examples/imaginary/Primes/Vector.hs [moved from dph-examples/imaginary/Primes/PrimesVector.hs with 86% similarity]
dph-examples/examples/imaginary/Primes/Vectorised.hs [moved from dph-examples/imaginary/Primes/PrimesVectorised.hs with 92% similarity]
dph-examples/examples/imaginary/Words/Main.hs [moved from dph-examples/imaginary/Words/Main.hs with 98% similarity]
dph-examples/examples/imaginary/Words/Vectorised.hs [moved from dph-examples/imaginary/Words/WordsVect.hs with 99% similarity]
dph-examples/examples/real/NBody/Batch/Config.hs [moved from dph-examples/real/NBody/Batch/Config.hs with 100% similarity]
dph-examples/examples/real/NBody/Batch/MainArgs.hs [moved from dph-examples/real/NBody/Batch/MainArgs.hs with 100% similarity]
dph-examples/examples/real/NBody/Common/Body.hs [moved from dph-examples/real/NBody/Common/Body.hs with 100% similarity]
dph-examples/examples/real/NBody/Common/Dump.hs [moved from dph-examples/real/NBody/Common/Dump.hs with 100% similarity]
dph-examples/examples/real/NBody/Common/Util.hs [moved from dph-examples/real/NBody/Common/Util.hs with 100% similarity]
dph-examples/examples/real/NBody/Common/World.hs [moved from dph-examples/real/NBody/Common/World.hs with 100% similarity]
dph-examples/examples/real/NBody/Gloss/Config.hs [moved from dph-examples/real/NBody/Gloss/Config.hs with 100% similarity]
dph-examples/examples/real/NBody/Gloss/Draw.hs [moved from dph-examples/real/NBody/Gloss/Draw.hs with 100% similarity]
dph-examples/examples/real/NBody/Gloss/MainArgs.hs [moved from dph-examples/real/NBody/Gloss/MainArgs.hs with 100% similarity]
dph-examples/examples/real/NBody/MainBatch.hs [moved from dph-examples/real/NBody/MainBatch.hs with 100% similarity]
dph-examples/examples/real/NBody/MainGloss.hs [moved from dph-examples/real/NBody/MainGloss.hs with 100% similarity]
dph-examples/examples/real/NBody/Solver.hs [moved from dph-examples/real/NBody/Solver.hs with 100% similarity]
dph-examples/examples/real/NBody/Solver/ListBH/Solver.hs [moved from dph-examples/real/NBody/Solver/ListBH/Solver.hs with 100% similarity]
dph-examples/examples/real/NBody/Solver/NestedBH/Solver.hs [moved from dph-examples/real/NBody/Solver/NestedBH/Solver.hs with 100% similarity]
dph-examples/examples/real/NBody/Solver/VectorBH/Solver.hs [moved from dph-examples/real/NBody/Solver/VectorBH/Solver.hs with 100% similarity]
dph-examples/examples/real/NBody/Solver/VectorNaive/Solver.hs [moved from dph-examples/real/NBody/Solver/VectorNaive/Solver.hs with 100% similarity]
dph-examples/examples/real/Visibility/Draw.hs [moved from dph-examples/real/Visibility/Draw.hs with 100% similarity]
dph-examples/examples/real/Visibility/Geometry/Intersection.hs [moved from dph-examples/real/Visibility/Geometry/Intersection.hs with 100% similarity]
dph-examples/examples/real/Visibility/Geometry/Point.hs [moved from dph-examples/real/Visibility/Geometry/Point.hs with 100% similarity]
dph-examples/examples/real/Visibility/Geometry/Segment.hs [moved from dph-examples/real/Visibility/Geometry/Segment.hs with 100% similarity]
dph-examples/examples/real/Visibility/Interface.hs [moved from dph-examples/real/Visibility/Interface.hs with 100% similarity]
dph-examples/examples/real/Visibility/Main.hs [moved from dph-examples/real/Visibility/Main.hs with 100% similarity]
dph-examples/examples/real/Visibility/State.hs [moved from dph-examples/real/Visibility/State.hs with 100% similarity]
dph-examples/examples/real/Visibility/World.hs [moved from dph-examples/real/Visibility/World.hs with 100% similarity]
dph-examples/examples/smoke/data/Bool/Main.hs [new file with mode: 0644]
dph-examples/examples/smoke/data/Bool/Vectorised.hs [new file with mode: 0644]
dph-examples/examples/smoke/prims/Concat/Main.hs [moved from dph-examples/smoke/Concat/Main.hs with 74% similarity]
dph-examples/examples/smoke/prims/Concat/Vectorised.hs [moved from dph-examples/smoke/Concat/Solver.hs with 94% similarity]
dph-examples/examples/smoke/prims/Evens/c/evens.c [moved from dph-examples/imaginary/Evens/c/evens.c with 100% similarity]
dph-examples/examples/smoke/prims/Evens/dph/Main.hs [moved from dph-examples/imaginary/Evens/dph/Main.hs with 81% similarity]
dph-examples/examples/smoke/prims/Evens/dph/Vector.hs [moved from dph-examples/imaginary/Evens/dph/EvensVector.hs with 83% similarity]
dph-examples/examples/smoke/prims/Evens/dph/Vectorised.hs [moved from dph-examples/imaginary/Evens/dph/EvensVectorised.hs with 76% similarity]
dph-examples/examples/smoke/prims/SumSquares/c/sumsq.c [moved from dph-examples/imaginary/SumSquares/c/sumsq.c with 100% similarity]
dph-examples/examples/smoke/prims/SumSquares/dph/Main.hs [moved from dph-examples/imaginary/SumSquares/dph/Main.hs with 83% similarity]
dph-examples/examples/smoke/prims/SumSquares/dph/Vector.hs [moved from dph-examples/imaginary/SumSquares/dph/SumSquaresVector.hs with 83% similarity]
dph-examples/examples/smoke/prims/SumSquares/dph/Vectorised.hs [moved from dph-examples/imaginary/SumSquares/dph/SumSquaresVectorised.hs with 83% similarity]
dph-examples/examples/smoke/sharing/Indices/Main.hs [moved from dph-examples/broken/Indices/dph/Main.hs with 59% similarity]
dph-examples/examples/smoke/sharing/Indices/Vectorised.hs [moved from dph-examples/broken/Indices/dph/IndicesVectorised.hs with 73% similarity]
dph-examples/examples/smoke/sharing/Rank/Main.hs [moved from dph-examples/broken/Rank/dph/Main.hs with 80% similarity]
dph-examples/examples/smoke/sharing/Rank/Vectorised.hs [moved from dph-examples/broken/Rank/dph/RankVectorised.hs with 64% similarity]
dph-examples/examples/smoke/sharing/Reverse/Main.hs [moved from dph-examples/imaginary/Reverse/dph/Main.hs with 92% similarity]
dph-examples/examples/smoke/sharing/Reverse/Vector.hs [moved from dph-examples/imaginary/Reverse/dph/ReverseVector.hs with 91% similarity]
dph-examples/examples/smoke/sharing/Reverse/Vectorised.hs [moved from dph-examples/imaginary/Reverse/dph/ReverseVectorised.hs with 92% similarity]
dph-examples/examples/spectral/DotProduct/c/dotp.c [moved from dph-examples/imaginary/DotProduct/c/dotp.c with 100% similarity]
dph-examples/examples/spectral/DotProduct/dph/Main.hs [moved from dph-examples/imaginary/DotProduct/dph/Main.hs with 91% similarity]
dph-examples/examples/spectral/DotProduct/dph/Vector.hs [moved from dph-examples/imaginary/DotProduct/dph/DotProductVector.hs with 60% similarity]
dph-examples/examples/spectral/DotProduct/dph/Vectorised.hs [moved from dph-examples/imaginary/DotProduct/dph/DotProductVectorised.hs with 89% similarity]
dph-examples/examples/spectral/QuickHull/c/Main.c [moved from dph-examples/spectral/QuickHull/c/Main.c with 100% similarity]
dph-examples/examples/spectral/QuickHull/c/Makefile [moved from dph-examples/spectral/QuickHull/c/Makefile with 100% similarity]
dph-examples/examples/spectral/QuickHull/c/QuickHull.c [moved from dph-examples/spectral/QuickHull/c/QuickHull.c with 100% similarity]
dph-examples/examples/spectral/QuickHull/c/SVG.c [moved from dph-examples/spectral/QuickHull/c/SVG.c with 100% similarity]
dph-examples/examples/spectral/QuickHull/c/Timing.c [moved from dph-examples/spectral/QuickHull/c/Timing.c with 100% similarity]
dph-examples/examples/spectral/QuickHull/c/Timing.h [moved from dph-examples/spectral/QuickHull/c/Timing.h with 100% similarity]
dph-examples/examples/spectral/QuickHull/c/Vector.h [moved from dph-examples/spectral/QuickHull/c/Vector.h with 100% similarity]
dph-examples/examples/spectral/QuickHull/dph/Main.hs [moved from dph-examples/spectral/QuickHull/dph/Main.hs with 98% similarity]
dph-examples/examples/spectral/QuickHull/dph/Vectorised.hs [moved from dph-examples/spectral/QuickHull/dph/QuickHullVect.hs with 96% similarity]
dph-examples/examples/spectral/QuickHull/lib/SVG.hs [moved from dph-examples/spectral/QuickHull/lib/SVG.hs with 100% similarity]
dph-examples/examples/spectral/QuickHull/vector/Main.hs [moved from dph-examples/spectral/QuickHull/vector/Main.hs with 100% similarity]
dph-examples/examples/spectral/QuickHull/vector/QuickHullIO.hs [moved from dph-examples/spectral/QuickHull/vector/QuickHullIO.hs with 100% similarity]
dph-examples/examples/spectral/QuickHull/vector/QuickHullSplit.hs [moved from dph-examples/spectral/QuickHull/vector/QuickHullSplit.hs with 100% similarity]
dph-examples/examples/spectral/QuickHull/vector/QuickHullVector.hs [moved from dph-examples/spectral/QuickHull/vector/QuickHullVector.hs with 100% similarity]
dph-examples/examples/spectral/QuickSort/dph/Main.hs [moved from dph-examples/spectral/QuickSort/dph/Main.hs with 97% similarity]
dph-examples/examples/spectral/QuickSort/dph/Vectorised.hs [moved from dph-examples/spectral/QuickSort/dph/QuickSortVect.hs with 90% similarity]
dph-examples/examples/spectral/SMVM/c/mksm.c [moved from dph-examples/spectral/SMVM/c/mksm.c with 100% similarity]
dph-examples/examples/spectral/SMVM/c/smvm.c [moved from dph-examples/spectral/SMVM/c/smvm.c with 100% similarity]
dph-examples/examples/spectral/SMVM/dph/Main.hs [moved from dph-examples/spectral/SMVM/dph/Main.hs with 99% similarity]
dph-examples/examples/spectral/SMVM/dph/Vectorised.hs [moved from dph-examples/spectral/SMVM/dph/SMVMVectorised.hs with 92% similarity]

index ad54d98..94d20f3 100644 (file)
@@ -6,13 +6,16 @@ DPH_DEPENDS = \
         vector         == 0.9.*, \
         random         == 1.0.*, \
         old-time       == 1.0.*, \
+       containers      == 0.4.*, \
         dph-base       == 0.5.*, \
         dph-prim-par   == 0.5.*, \
-        dph-lifted-vseg        == 0.5.*
+        dph-lifted-vseg        == 0.5.*, \
+       HUnit           == 1.2.*
 
 
 # Options for compiling DPH examples.
 DPH_OPTIONS= \
+       -dcore-lint \
         -rtsopts \
         -threaded \
        -fllvm \
diff --git a/dph-examples/README b/dph-examples/README
new file mode 100644 (file)
index 0000000..8af889c
--- /dev/null
@@ -0,0 +1,28 @@
+
+Data Parallel Haskell Examples
+
+ broken             
+   Examples that have never worked, or don't anymore.
+
+ examples/smoke
+   Smoke tests are there to check that the library works, but no one would want
+   the output. This is where we try to concatentate a random array and see what
+   happens.
+
+   examples/smoke/data     Test vectorisation of data types.
+   examples/smoke/prims    Test functions in the lifted primitive library
+   examples/smoke/sharing  Test for work complexity problems related to sharing.
+
+ examples/imaginary
+   Imaginary micro benchmarks compute a useful result, but not in a computationally
+   relevant way. This inefficiency is good for stress testing DPH, but they are
+   too slow to be useful in practice.
+
+ examples/spectral
+   Spectral benchmarks are kernels of real algorithms. They do something useful in
+   a computatinally relevant way, but are not complete application programs.
+
+ examples/real
+   Real programs are the ones that might be used for some purpose other than
+   testing DPH.
+
diff --git a/dph-examples/broken/Tree/Solver.hs b/dph-examples/broken/Tree/Solver.hs
new file mode 100644 (file)
index 0000000..e269c41
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE ParallelArrays #-}
+{-# OPTIONS -fvectorise #-}
+module Solver where
+import Data.Array.Parallel.Prelude
+import Data.Array.Parallel.Prelude.Int
+
+data Thing
+-- data Nothing 
+        
+        
\ No newline at end of file
index d15d373..87c2ab6 100644 (file)
@@ -1,6 +1,5 @@
 
 
-
 Name:                dph-examples
 Version:             0.5.2.0
 License:             BSD3
@@ -23,110 +22,138 @@ Synopsis:            Examples using Data Parallel Haskell
 --   the plain dph-NAME versions are parallel versions built against dph-par
 --   while the dph_NAME-seq versions are sequential ones built against dph-seq
 
--- Sum of Squares -------------------------------------------------------------
-Executable dph-sumsq
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+
+-- Smoke ----------------------------------------------------------------------
+-- examples/smoke/data
+Executable dph-smoke-bool
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  SumSquaresVector
-                  SumSquaresVectorised
-                  Timing Randomish
-  hs-source-dirs: lib imaginary/SumSquares/dph
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  other-modules:  Vectorised
+  hs-source-dirs: examples/smoke/data/Bool
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- Dot Product ----------------------------------------------------------------
-Executable dph-dotp
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+-- examples/smoke/prims
+Executable dph-smoke-concat
+  build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
+  main-is:        Main.hs
+  other-modules:  Vectorised
+  hs-source-dirs: examples/smoke/prims/Concat
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+
+
+Executable dph-smoke-sumsq
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
+  Main-is:        Main.hs
+  other-modules:  Vector
+                  Vectorised
+                  Timing Randomish
+  hs-source-dirs: examples/smoke/prims/SumSquares/dph lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+Executable dph-smoke-evens
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  DotProductVector
-                  DotProductVectorised
+  other-modules:  Vector
+                  Vectorised
                   Timing Randomish
-  hs-source-dirs: lib imaginary/DotProduct/dph
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  hs-source-dirs: examples/smoke/prims/Evens/dph lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- Evens ----------------------------------------------------------------------
-Executable dph-evens
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+-- examples/smoke/sharing
+Executable dph-smoke-indices
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  EvensVector
-                  EvensVectorised
-                  Timing Randomish
-  hs-source-dirs: imaginary/Evens/dph lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  other-modules:  Vectorised
+  hs-source-dirs: examples/smoke/sharing/Indices lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+Executable dph-smoke-rank
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
+  Main-is:        Main.hs
+  other-modules:  Vectorised Util Timing Randomish
+  hs-source-dirs: examples/smoke/sharing/Rank lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- Primes ---------------------------------------------------------------------
--- Primes dies with a bounds check error
-Executable dph-primes
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+Executable dph-smoke-reverse
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  hs-source-dirs: imaginary/Primes lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  other-modules:  Vectorised Randomish
+  hs-source-dirs: examples/smoke/sharing/Reverse lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- Reverse --------------------------------------------------------------------
-Executable dph-reverse
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+-- Imaginary ------------------------------------------------------------------
+Executable dph-imaginary-primes
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  ReverseVector
-                  ReverseVectorised
-                  Util Timing Randomish
-  hs-source-dirs: imaginary/Reverse/dph lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  other-modules:  Vectorised
+  hs-source-dirs: examples/imaginary/Primes lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+
+Executable dph-imaginary-words
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
+  Main-is:        Main.hs
+  other-modules:  Vectorised
+  hs-source-dirs: examples/imaginary/Words lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- Words ---------------------------------------------------------------------
-Executable dph-words
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+-- Spectral -------------------------------------------------------------------
+Executable dph-spectral-dotp
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  hs-source-dirs: imaginary/Words lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  other-modules:  Vector
+                  Vectorised
+                  Timing Randomish
+  hs-source-dirs: examples/spectral/DotProduct/dph lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- SMVM ---------------------------------------------------------------------
-Executable dph-smvm
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+Executable dph-spectral-smvm
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  SMVMVectorised
+  other-modules:  Vectorised
                   Timing
-  hs-source-dirs: spectral/SMVM/dph lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  hs-source-dirs: examples/spectral/SMVM/dph lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- QuickHull ------------------------------------------------------------------
-Executable dph-quickhull
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+Executable dph-spectral-quickhull
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  QuickHullVect
+  other-modules:  Vectorised
                   Timing Points2D.Types SVG
-  hs-source-dirs: lib spectral/QuickHull/dph spectral/QuickHull/lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  hs-source-dirs: examples/spectral/QuickHull/dph examples/spectral/QuickHull/lib lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
-Executable dph-quickhull-vector
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+Executable dph-spectral-quickhull-vector
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
   other-modules:  QuickHullIO
                   QuickHullSplit
                   QuickHullVector
                   Timing Points2D.Types SVG
-  hs-source-dirs: lib spectral/QuickHull/vector spectral/QuickHull/lib
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  hs-source-dirs: examples/spectral/QuickHull/vector examples/spectral/QuickHull/lib lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- QuickSort ------------------------------------------------------------------
-Executable dph-quicksort
-  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
+Executable dph-spectral-quicksort
+  Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
   Main-is:        Main.hs
-  other-modules:  QuickSortVect
+  other-modules:  Vectorised
                   Timing
-  hs-source-dirs: lib spectral/QuickSort/dph
-  ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
+  hs-source-dirs: examples/spectral/QuickSort/dph lib
+  ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
 
--- NBody ----------------------------------------------------------------------
--- Executable dph-nbody-gloss
+-- Real -----------------------------------------------------------------------
+-- Executable dph-real-nbody-gloss
 --     Main-is:        MainGloss.hs
 --     other-modules:  Common.Dump Common.World Common.Body Common.Util 
 --                     Solver Solver.ListBH.Solver
@@ -135,12 +162,12 @@ Executable dph-quicksort
 --                            Solver.VectorNaive.Solver
 --                     Timing Points2D.Types Points2D.Generate
 --                     Gloss.MainArgs Gloss.Draw Gloss.Config
---     Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, parseargs == 0.1.*, gloss == 1.3.*
+--     Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*, parseargs == 0.1.*, gloss == 1.3.*
 --     hs-source-dirs: lib real/NBody real/NBody/Gloss
---     ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000 -fno-liberate-case
+--     ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000 -fno-liberate-case
 
 
-Executable dph-nbody-batch
+Executable dph-real-nbody
     Main-is:        MainBatch.hs
     other-modules:  Common.Dump Common.World Common.Body Common.Util 
                     Solver Solver.ListBH.Solver
@@ -149,7 +176,7 @@ Executable dph-nbody-batch
                            Solver.VectorNaive.Solver
                     Timing Points2D.Types Points2D.Generate
                     Batch.MainArgs Batch.Config
-    Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*
-    hs-source-dirs: lib real/NBody real/NBody/Batch
-    ghc-options:    -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000 -fno-liberate-case
+    Build-depends:  base == 4.4.*, vector == 0.9.*, random == 1.0.*, old-time == 1.0.*, containers == 0.4.*, dph-base == 0.5.*, dph-prim-par == 0.5.*, dph-lifted-vseg == 0.5.*, HUnit == 1.2.*
+    hs-source-dirs: examples/real/NBody examples/real/NBody/Batch lib
+    ghc-options:    -dcore-lint -rtsopts -threaded -fllvm -Odph -package dph-lifted-vseg -fcpr-off -fno-liberate-case -fno-spec-constr -fsimpl-tick-factor=1000
 
index f4468e7..8c47737 100644 (file)
@@ -1,4 +1,3 @@
-
 Name:                dph-examples
 Version:             0.5.2.0
 License:             BSD3
@@ -21,110 +20,138 @@ Synopsis:            Examples using Data Parallel Haskell
 --   the plain dph-NAME versions are parallel versions built against dph-par
 --   while the dph_NAME-seq versions are sequential ones built against dph-seq
 
--- Sum of Squares -------------------------------------------------------------
-Executable dph-sumsq
+
+-- Smoke ----------------------------------------------------------------------
+-- examples/smoke/data
+Executable dph-smoke-bool
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  SumSquaresVector
-                  SumSquaresVectorised
-                  Timing Randomish
-  hs-source-dirs: lib imaginary/SumSquares/dph
+  other-modules:  Vectorised
+  hs-source-dirs: examples/smoke/data/Bool
   ghc-options:    DPH_OPTIONS
 
 
--- Dot Product ----------------------------------------------------------------
-Executable dph-dotp
+-- examples/smoke/prims
+Executable dph-smoke-concat
+  build-depends:  DPH_DEPENDS
+  main-is:        Main.hs
+  other-modules:  Vectorised
+  hs-source-dirs: examples/smoke/prims/Concat
+  ghc-options:    DPH_OPTIONS
+
+
+Executable dph-smoke-sumsq
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  DotProductVector
-                  DotProductVectorised
+  other-modules:  Vector
+                  Vectorised
                   Timing Randomish
-  hs-source-dirs: lib imaginary/DotProduct/dph
+  hs-source-dirs: examples/smoke/prims/SumSquares/dph lib
+  ghc-options:    DPH_OPTIONS
+Executable dph-smoke-evens
+  Build-depends:  DPH_DEPENDS
+  Main-is:        Main.hs
+  other-modules:  Vector
+                  Vectorised
+                  Timing Randomish
+  hs-source-dirs: examples/smoke/prims/Evens/dph lib
   ghc-options:    DPH_OPTIONS
 
 
--- Evens ----------------------------------------------------------------------
-Executable dph-evens
+-- examples/smoke/sharing
+Executable dph-smoke-indices
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  EvensVector
-                  EvensVectorised
-                  Timing Randomish
-  hs-source-dirs: imaginary/Evens/dph lib
+  other-modules:  Vectorised
+  hs-source-dirs: examples/smoke/sharing/Indices lib
+  ghc-options:    DPH_OPTIONS
+Executable dph-smoke-rank
+  Build-depends:  DPH_DEPENDS
+  Main-is:        Main.hs
+  other-modules:  Vectorised Util Timing Randomish
+  hs-source-dirs: examples/smoke/sharing/Rank lib
   ghc-options:    DPH_OPTIONS
 
 
--- Primes ---------------------------------------------------------------------
--- Primes dies with a bounds check error
-Executable dph-primes
+Executable dph-smoke-reverse
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  hs-source-dirs: imaginary/Primes lib
+  other-modules:  Vectorised Randomish
+  hs-source-dirs: examples/smoke/sharing/Reverse lib
   ghc-options:    DPH_OPTIONS
 
 
--- Reverse --------------------------------------------------------------------
-Executable dph-reverse
+-- Imaginary ------------------------------------------------------------------
+Executable dph-imaginary-primes
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  ReverseVector
-                  ReverseVectorised
-                  Util Timing Randomish
-  hs-source-dirs: imaginary/Reverse/dph lib
+  other-modules:  Vectorised
+  hs-source-dirs: examples/imaginary/Primes lib
   ghc-options:    DPH_OPTIONS
 
+Executable dph-imaginary-words
+  Build-depends:  DPH_DEPENDS
+  Main-is:        Main.hs
+  other-modules:  Vectorised
+  hs-source-dirs: examples/imaginary/Words lib
+  ghc-options:    DPH_OPTIONS
 
--- Words ---------------------------------------------------------------------
-Executable dph-words
+
+-- Spectral -------------------------------------------------------------------
+Executable dph-spectral-dotp
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  hs-source-dirs: imaginary/Words lib
+  other-modules:  Vector
+                  Vectorised
+                  Timing Randomish
+  hs-source-dirs: examples/spectral/DotProduct/dph lib
   ghc-options:    DPH_OPTIONS
 
 
--- SMVM ---------------------------------------------------------------------
-Executable dph-smvm
+Executable dph-spectral-smvm
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  SMVMVectorised
+  other-modules:  Vectorised
                   Timing
-  hs-source-dirs: spectral/SMVM/dph lib
+  hs-source-dirs: examples/spectral/SMVM/dph lib
   ghc-options:    DPH_OPTIONS
 
 
--- QuickHull ------------------------------------------------------------------
-Executable dph-quickhull
+Executable dph-spectral-quickhull
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  QuickHullVect
+  other-modules:  Vectorised
                   Timing Points2D.Types SVG
-  hs-source-dirs: lib spectral/QuickHull/dph spectral/QuickHull/lib
+  hs-source-dirs: examples/spectral/QuickHull/dph examples/spectral/QuickHull/lib lib
   ghc-options:    DPH_OPTIONS
 
 
-Executable dph-quickhull-vector
+Executable dph-spectral-quickhull-vector
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
   other-modules:  QuickHullIO
                   QuickHullSplit
                   QuickHullVector
                   Timing Points2D.Types SVG
-  hs-source-dirs: lib spectral/QuickHull/vector spectral/QuickHull/lib
+  hs-source-dirs: examples/spectral/QuickHull/vector examples/spectral/QuickHull/lib lib
   ghc-options:    DPH_OPTIONS
 
 
--- QuickSort ------------------------------------------------------------------
-Executable dph-quicksort
+Executable dph-spectral-quicksort
   Build-depends:  DPH_DEPENDS
   Main-is:        Main.hs
-  other-modules:  QuickSortVect
+  other-modules:  Vectorised
                   Timing
-  hs-source-dirs: lib spectral/QuickSort/dph
+  hs-source-dirs: examples/spectral/QuickSort/dph lib
   ghc-options:    DPH_OPTIONS
 
 
--- NBody ----------------------------------------------------------------------
--- Executable dph-nbody-gloss
+-- Real -----------------------------------------------------------------------
+-- Executable dph-real-nbody-gloss
 --     Main-is:        MainGloss.hs
 --     other-modules:  Common.Dump Common.World Common.Body Common.Util 
 --                     Solver Solver.ListBH.Solver
@@ -138,16 +165,24 @@ Executable dph-quicksort
 --     ghc-options:    DPH_OPTIONS -fno-liberate-case
 
 
-Executable dph-nbody-batch
-    Main-is:        MainBatch.hs
-    other-modules:  Common.Dump Common.World Common.Body Common.Util 
-                    Solver Solver.ListBH.Solver
-                           Solver.NestedBH.Solver
-                           Solver.VectorBH.Solver
-                           Solver.VectorNaive.Solver
-                    Timing Points2D.Types Points2D.Generate
-                    Batch.MainArgs Batch.Config
-    Build-depends:  DPH_DEPENDS
-    hs-source-dirs: lib real/NBody real/NBody/Batch
-    ghc-options:    DPH_OPTIONS -fno-liberate-case
+
+-- Executable dph-real-nbody
+--     Main-is:        MainBatch.hs
+--     other-modules:  Common.Dump Common.World Common.Body Common.Util 
+--                     Solver Solver.ListBH.Solver
+--                            Solver.NestedBH.Solver
+--                            Solver.VectorBH.Solver
+--                            Solver.VectorNaive.Solver
+--                     Timing Points2D.Types Points2D.Generate
+--                     Batch.MainArgs Batch.Config
+--     Build-depends:  DPH_DEPENDS
+--     hs-source-dirs: examples/real/NBody examples/real/NBody/Batch lib
+--     ghc-options:    DPH_OPTIONS
+
+-- dph-real-nbody is broken due to vectorisation error
+-- *** Vectorisation error ***
+--     No exact 'PData' family instance for
+--         Data.Array.Parallel.PArray.Types.Wrap
+--           (Data.Array.Parallel.PArray.PData.Base.PArray
+--              Solver.NestedBH.Solver.V:BHTree)
 
similarity index 94%
rename from dph-examples/imaginary/Primes/Main.hs
rename to dph-examples/examples/imaginary/Primes/Main.hs
index 0d9cca2..ff9e6f3 100644 (file)
@@ -1,5 +1,5 @@
 
-import PrimesVectorised
+import Vectorised
 import Timing
 import Randomish
 import System.Environment
@@ -7,7 +7,7 @@ import Data.Vector.Unboxed              (Vector)
 import Data.Array.Parallel     as P
 import Data.Array.Parallel.PArray      as P
 import qualified Data.Vector.Unboxed   as V
-import qualified PrimesVector          as V
+import qualified Vector                as V
 import Data.Maybe
 
 main :: IO ()
@@ -1,5 +1,5 @@
 
-module PrimesVector where
+module Vector where
 import Data.Vector.Unboxed             (Vector)
 import qualified Data.Vector.Unboxed   as V
 
@@ -1,6 +1,6 @@
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module PrimesVectorised (primesPA) where
+module Vectorised (primesPA) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Int 
 import qualified Prelude
similarity index 98%
rename from dph-examples/imaginary/Words/Main.hs
rename to dph-examples/examples/imaginary/Words/Main.hs
index 836e446..9fd5490 100644 (file)
@@ -1,5 +1,5 @@
 
-import WordsVect
+import Vectorised
 import Data.Array.Parallel
 import qualified Data.Array.Parallel.Prelude.Word8     as W
 import qualified Data.Array.Parallel.PArray            as P
@@ -1,7 +1,7 @@
 {-# LANGUAGE ParallelArrays, ParallelListComp #-}
 {-# OPTIONS -fvectorise #-}
 
-module WordsVect
+module Vectorised
        ( wordsOfPArray
        , wordCountOfPArray )
 where
diff --git a/dph-examples/examples/smoke/data/Bool/Main.hs b/dph-examples/examples/smoke/data/Bool/Main.hs
new file mode 100644 (file)
index 0000000..72cb662
--- /dev/null
@@ -0,0 +1,7 @@
+
+-- | Test vectorisation of enumerations.
+--   This tests the conversion to and from our generic representation.
+import Vectorised
+import qualified Data.Array.Parallel.PArray     as P
+
+main    = print $ P.toList $ test $ P.fromList [0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1]
\ No newline at end of file
diff --git a/dph-examples/examples/smoke/data/Bool/Vectorised.hs b/dph-examples/examples/smoke/data/Bool/Vectorised.hs
new file mode 100644 (file)
index 0000000..ce2f58e
--- /dev/null
@@ -0,0 +1,28 @@
+
+{-# LANGUAGE ParallelArrays #-}
+{-# OPTIONS -fvectorise #-}
+module Vectorised (test) where
+import Data.Array.Parallel              hiding (Bool, True, False, not)
+import Data.Array.Parallel.Prelude      hiding (Bool, True, False, not)
+import Data.Array.Parallel.Prelude.Int
+import qualified Prelude        as P
+        
+data Bool = True | False
+
+toBool :: Int -> Bool
+toBool n
+ | n == 0       = False
+ | otherwise    = True
+
+fromBool :: Bool -> Int
+fromBool False  = 0
+fromBool True   = 1
+
+not :: Bool -> Bool
+not False       = True
+not True        = False
+
+{-# NOINLINE test #-}
+test :: PArray Int -> PArray Int
+test xs = toPArrayP (mapP test' (fromPArrayP xs))
+test' x = fromBool (not (toBool x))
similarity index 74%
rename from dph-examples/smoke/Concat/Main.hs
rename to dph-examples/examples/smoke/prims/Concat/Main.hs
index 56d139c..a4f48c4 100644 (file)
@@ -1,5 +1,8 @@
 
-import Solver 
+-- | Test out contatentation. 
+--   Concatenation is a core operation that exercises the representation of nested
+--   arrays, as well as the extractsPR function from the dph-lifted-vseg library.
+import Vectorised 
 import Test.HUnit
 import qualified Data.Array.Parallel.PArray     as PA
 
similarity index 94%
rename from dph-examples/smoke/Concat/Solver.hs
rename to dph-examples/examples/smoke/prims/Concat/Vectorised.hs
index cddbcf1..8979689 100644 (file)
@@ -1,6 +1,7 @@
+
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module Solver 
+module Vectorised 
         (test0, test1, test2, test3, test4)
 where
 import Data.Array.Parallel
@@ -1,6 +1,9 @@
 
-import EvensVectorised                 as Z
-import EvensVector                     as V
+-- | Test filter operations.
+--   These are fairly involved because the implementation uses selectors and
+--   the packByTag array primitive.
+import Vectorised                      as Z
+import Vector                          as V
 import qualified Data.Vector.Unboxed   as V
 import Timing
 import System.Environment
@@ -1,5 +1,5 @@
 
-module EvensVector (evensV) where
+module Vector (evensV) where
 import Data.Vector.Unboxed             (Vector)
 import qualified Data.Vector.Unboxed   as V
 
@@ -1,13 +1,12 @@
+
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-
-module EvensVectorised (evensPA) where
+module Vectorised (evensPA) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Int
 import Data.Array.Parallel.Prelude.Bool
 import qualified Prelude as P
 
--- | DPH filter opereations are reasonably involved because they use packByTag.
 evens :: [:Int:] -> [:Int:]
 evens ints = filterP (\x -> x `mod` 2 == 0) ints
 
@@ -1,10 +1,11 @@
 
+-- | Test maps, sums and enumerations.
 import Timing
 import Randomish
 import System.Environment
+import qualified Vector                        as V
+import qualified Vectorised            as Z
 import qualified Data.Vector.Unboxed   as V
-import qualified SumSquaresVector      as V
-import qualified SumSquaresVectorised  as Z
 
 main :: IO ()
 main 
@@ -1,5 +1,5 @@
 
-module SumSquaresVector where
+module Vector where
 import qualified Data.Vector.Unboxed    as V
        
 sumSq :: Int -> Double
@@ -1,6 +1,7 @@
+
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module SumSquaresVectorised (sumSq) where
+module Vectorised (sumSq) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Int                 as I
 import Data.Array.Parallel.Prelude.Double      as D
@@ -1,15 +1,18 @@
 
+-- | This divide and conquer program accesseses top-level array from the
+--   computations at the bottom of the tree. In lifted backends that
+--   don't manage sharing properly, this program will blow up when it tries
+--   to replicate the top-level a array at every step in the division phase.
 import Util
 import Timing
 import Randomish
 import System.Environment
 import Control.Exception
-import qualified IndicesVectorised              as ID
+import qualified Vectorised                     as ID
 import qualified Data.Array.Parallel.PArray     as P
 import qualified Data.Vector.Unboxed            as V
 
-
-main 
+main
  = do   args    <- getArgs
         
         case args of
@@ -18,15 +21,15 @@ main
 
 
 run "vectorised" count
- = do   let arr = P.fromListPA [0 .. count - 1]
+ = do   let arr = P.fromList [0 .. count - 1]
         arr `seq` return ()     
                 
         (arrResult, tElapsed)
          <- time
          $  let  arr'    = ID.indicesPA arr arr
-            in   P.nfPA arr' `seq` return arr'
+            in   P.nf arr' `seq` return arr'
 
-        print   $ P.lengthPA arrResult
+        print   $ P.length arrResult
         putStr  $ prettyTime tElapsed
 
 run _ _
@@ -1,44 +1,24 @@
+
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module IndicesVectorised        
-        (indicesPA, indices)
-where
+module Vectorised (indicesPA, indices) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Int
 import Data.Array.Parallel.Prelude.Bool
 import qualified Prelude as P
 
 
-indicesPA :: PArray Int -> PArray Int -> PArray Int
 {-# NOINLINE indicesPA #-}
+indicesPA :: PArray Int -> PArray Int -> PArray Int
 indicesPA arr ixs
         = toPArrayP (indices (fromPArrayP arr) (fromPArrayP ixs))
 
-
 indices :: [:Int:] -> [:Int:] -> [:Int:]
 indices arr ixs
  = treeLookup arr ixs
 
-{-
- = mapP (thing arr) ixs
-thing :: [:Int:] -> Int -> Int
-thing arr i
- = (sliceP i 1 arr) !: 0 
-
-
-         
--- arr !: i 
-
-thingo :: [:Int:] -> [:Int:] -> [:Int:]
-thingo table is
- = go is
- where  go is'
-          = 
--}
-
-treeLookup :: [:Int:] -> [:Int:] -> [:Int:]
 {-# NOINLINE treeLookup #-}
+treeLookup :: [:Int:] -> [:Int:] -> [:Int:]
 treeLookup table xx
  | lengthP xx == 1
  = [: table !: (xx !: 0) :]
similarity index 80%
rename from dph-examples/broken/Rank/dph/Main.hs
rename to dph-examples/examples/smoke/sharing/Rank/Main.hs
index 6f9e5d2..6904b54 100644 (file)
@@ -1,13 +1,15 @@
+
+-- | In with lifted backends that don't manage sharing properly, the rank
+--   example suffers similar work complexity problems as the indices example.
 import Util
 import Timing
 import Randomish
 import System.Environment
 import Control.Exception
-import qualified RankVectorised                 as RD
+import qualified Vectorised                     as RD
 import qualified Data.Array.Parallel.PArray     as PA
 import qualified Data.Vector.Unboxed            as V
 
-
 main 
  = do   args    <- getArgs
         
@@ -1,8 +1,6 @@
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module RankVectorised        
-        (ranksPA)
-where
+module Vectorised (ranksPA) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Int
 import Data.Array.Parallel.Prelude.Bool
@@ -10,11 +8,11 @@ import qualified Prelude as P
 
 
 ranksPA :: PArray Int -> PArray Int
+ranksPA ps = toPArrayP (ranks (fromPArrayP ps))
 {-# NOINLINE ranksPA #-}
-ranksPA ps
-        = toPArrayP (ranks (fromPArrayP ps))
+
 
 ranks :: [:Int:] -> [:Int:]
+ranks arr  = [: lengthP [: a | a <- arr, a < b :] | b <- arr :]
 {-# NOINLINE ranks #-}
-ranks arr = [: lengthP [: a | a <- arr, a < b :] | b <- arr :]
 
@@ -5,8 +5,8 @@ import Randomish
 import System.Environment
 import System.Random
 import Control.Exception
-import qualified ReverseVector                  as RV
-import qualified ReverseVectorised              as RD
+import qualified Vector                         as RV
+import qualified Vectorised                     as RD
 import qualified Data.Array.Parallel.PArray     as P
 import qualified Data.Vector.Unboxed            as V
 
@@ -1,7 +1,5 @@
 
-module ReverseVector
-        (treeReverse)
-where
+module Vector (treeReverse) where
 import qualified Data.Vector.Unboxed as V
 import Data.Vector.Unboxed              (Vector)
 
@@ -1,8 +1,6 @@
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module ReverseVectorised        
-        (treeReversePA)
-where
+module Vectorised (treeReversePA) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Int
 import Data.Array.Parallel.Prelude.Bool
@@ -5,8 +5,8 @@ import System.Environment
 import Data.Array.Parallel     as P
 import Data.Array.Parallel.PArray      as P
 import qualified Data.Vector.Unboxed   as V
-import qualified DotProductVector      as V
-import qualified DotProductVectorised  as Z
+import qualified Vector                        as V
+import qualified Vectorised            as Z
 
 main :: IO ()
 main 
@@ -1,5 +1,5 @@
 
-module DotProductVector (dotV) where
+module Vector (dotV) where
 import Data.Vector.Unboxed             (Vector)
 import qualified Data.Vector.Unboxed   as V
 
@@ -1,6 +1,6 @@
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module DotProductVectorised ( dotPA ) where
+module Vectorised ( dotPA ) where
 
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Double as D
@@ -8,8 +8,8 @@ import Data.Array.Parallel.Prelude.Double as D
 import qualified Prelude
 
 dotPA :: PArray Double -> PArray Double -> Double
-{-# NOINLINE dotPA #-}
 dotPA v w = dotp' (fromPArrayP v) (fromPArrayP w)
+{-# NOINLINE dotPA #-}
 
 dotp' :: [:Double:] -> [:Double:] -> Double
 dotp' v w = D.sumP (zipWithP (*) v w)
@@ -1,5 +1,5 @@
 
-import QuickHullVect
+import Vectorised
 import SVG
 import Timing
 import Points2D.Generate
@@ -1,7 +1,7 @@
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
 
-module QuickHullVect (quickhullPA) where
+module Vectorised (quickhullPA) where
 import Points2D.Types
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Bool
@@ -38,6 +38,6 @@ quickHull points
 
 
 quickhullPA :: PArray Point -> PArray Point
-{-# NOINLINE quickhullPA #-}
 quickhullPA ps = toPArrayP (quickHull (fromPArrayP ps))
+{-# NOINLINE quickhullPA #-}
 
@@ -1,5 +1,5 @@
 
-import QuickSortVect
+import Vectorised
 import Timing
 import Randomish
 import System.Environment
@@ -1,19 +1,19 @@
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
 {-# OPTIONS -fno-spec-constr-count #-}
-module QuickSortVect (quicksortPA) where
-
+module Vectorised (quicksortPA) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Double
 import qualified Data.Array.Parallel.Prelude.Int as I
-
 import qualified Prelude
 
+
+{-# NOINLINE quicksortPA #-}
 quicksortPA:: PArray Double -> PArray Double 
 quicksortPA xs = toPArrayP  (qsortVect' (fromPArrayP xs))
 
+
 qsortVect':: [: Double :] -> [: Double :]
-{-# NOINLINE qsortVect' #-}
 qsortVect' xs | lengthP xs I.<=  1 = xs
               | otherwise =
   let p  = xs !: (lengthP xs `I.div` 2)
similarity index 99%
rename from dph-examples/spectral/SMVM/dph/Main.hs
rename to dph-examples/examples/spectral/SMVM/dph/Main.hs
index ab054dc..cbdbdd7 100644 (file)
@@ -1,7 +1,7 @@
 {-# LANGUAGE ScopedTypeVariables #-}
 
 import Timing
-import SMVMVectorised
+import Vectorised
 import System.IO
 import Foreign.Storable
 import Foreign.Marshal.Alloc
@@ -1,17 +1,15 @@
 
 {-# LANGUAGE ParallelArrays #-}
 {-# OPTIONS -fvectorise #-}
-module SMVMVectorised (smvmPA) where
-
+module Vectorised (smvmPA) where
 import Data.Array.Parallel
 import Data.Array.Parallel.Prelude.Double as D
 import Data.Array.Parallel.Prelude.Int    as I
-
 import qualified Prelude as P
 
 smvmPA :: PArray (PArray (Int, Double)) -> PArray Double -> PArray Double
-{-# NOINLINE smvmPA #-}
 smvmPA m v = toPArrayP (smvm (fromNestedPArrayP m) (fromPArrayP v))
+{-# NOINLINE smvmPA #-}
 
 
 smvm :: [:[: (Int, Double) :]:] -> [:Double:] -> [:Double:]