diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-06-02 11:56:58 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-02 16:21:12 -0400 |
commit | faee23bb69ca813296da484bc177f4480bcaee9f (patch) | |
tree | 28e1c99f0de9d505c1df81ae7459839f5db4121c /testsuite/tests/dph/nbody/Generate.hs | |
parent | 13a86606e51400bc2a81a0e04cfbb94ada5d2620 (diff) | |
download | haskell-faee23bb69ca813296da484bc177f4480bcaee9f.tar.gz |
vectorise: Put it out of its misery
Poor DPH and its vectoriser have long been languishing; sadly it seems there is
little chance that the effort will be rekindled. Every few years we discuss
what to do with this mass of code and at least once we have agreed that it
should be archived on a branch and removed from `master`. Here we do just that,
eliminating heaps of dead code in the process.
Here we drop the ParallelArrays extension, the vectoriser, and the `vector` and
`primitive` submodules.
Test Plan: Validate
Reviewers: simonpj, simonmar, hvr, goldfire, alanz
Reviewed By: simonmar
Subscribers: goldfire, rwbarton, thomie, mpickering, carter
Differential Revision: https://phabricator.haskell.org/D4761
Diffstat (limited to 'testsuite/tests/dph/nbody/Generate.hs')
-rw-r--r-- | testsuite/tests/dph/nbody/Generate.hs | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/testsuite/tests/dph/nbody/Generate.hs b/testsuite/tests/dph/nbody/Generate.hs deleted file mode 100644 index 5b700ddec5..0000000000 --- a/testsuite/tests/dph/nbody/Generate.hs +++ /dev/null @@ -1,98 +0,0 @@ -{-# LANGUAGE TypeOperators #-} -module Generate - ( genPointsUniform - , genPointsUniformWithSeed - , genPointsDisc - , genPointsCombo - , pointsPArrayOfUArray ) -where -import Types -import Randomish -import qualified Data.Array.Parallel.Unlifted as U -import qualified Data.Array.Parallel as P -import qualified Data.Array.Parallel.PArray as P -import Data.Array.Parallel.PArray (PArray) -import Control.Exception - --- Random points generation --- IMPORTANT: We use the same seed with the same random generator in all --- quickhull codes. The asymptotic work complexity of quickhull --- is between O (N) and O (N^2) depending on the input. --- To compare benchmark results, they always need to use the same --- input. -seed :: Int -seed = 42742 - --- | Some uniformly distributed points -genPointsUniform - :: Int -- ^ number of points - -> Double -- ^ minimum coordinate - -> Double -- ^ maximum coordinate - -> U.Array (Double, Double) - -genPointsUniform n pointMin pointMax - = let pts = randomishDoubles (n*2) pointMin pointMax seed - xs = U.extract pts 0 n - ys = U.extract pts n n - in U.zip xs ys - - --- | Some uniformly distributed points -genPointsUniformWithSeed - :: Int -- ^ seed - -> Int -- ^ number of points - -> Double -- ^ minimum coordinate - -> Double -- ^ maximum coordinate - -> U.Array (Double, Double) - -genPointsUniformWithSeed seed' n pointMin pointMax - = let pts = randomishDoubles (n*2) pointMin pointMax seed' - xs = U.extract pts 0 n - ys = U.extract pts n n - in U.zip xs ys - - --- | Some points distributed as a disc -genPointsDisc - :: Int -- ^ number of points - -> (Double, Double) -- ^ center of disc - -> Double -- ^ radius of disc - -> U.Array (Double, Double) - -genPointsDisc n (originX, originY) radiusMax - = let radius = randomishDoubles n 0 radiusMax seed - angle = randomishDoubles n (-pi) pi (seed + 1234) - - makeXY r a - = ( originX + r * cos a - , originY + r * sin a) - - in originX `seq` originY `seq` U.zipWith makeXY radius angle - - --- | A point cloud with areas of high and low density -genPointsCombo - :: Int -- ^ number of points - -> U.Array (Double, Double) - -genPointsCombo n - = genPointsDisc (n `div` 5) (250, 250) 200 - U.+:+ genPointsDisc (n `div` 5) (100, 100) 80 - U.+:+ genPointsDisc (n `div` 5) (150, 300) 30 - U.+:+ genPointsDisc (n `div` 5) (500, 120) 30 - U.+:+ genPointsDisc (n `div` 5) (300, 200) 150 - - --- | Convert a list of points to a PArray -pointsPArrayOfUArray - :: U.Array (Double, Double) - -> IO (PArray Point) - -pointsPArrayOfUArray ps - = do - let pts = makePointsPA - (P.fromUArray (U.fsts ps)) - (P.fromUArray (U.snds ps)) - evaluate $ P.nf pts - return pts - |