Commit 621a7bdd authored by Simon Marlow's avatar Simon Marlow

update to work with the latest parallel package

parent bc7468fa
......@@ -78,7 +78,7 @@ payA_par depth val ((c,q):coins) acc
| otherwise = res
where
res = unEval $ pure append <*> rpar left <*> rwhnf right
res = runEval $ pure append <*> rpar left <*> rseq right
left = payA_par (if q == 1 then (depth-1) else depth) (val - c) coins' (c:acc)
right = payA_par (depth-1) val coins acc
......
......@@ -14,7 +14,7 @@ module Illumination
) where
import Control.Parallel
import Control.Parallel.Strategies (withStrategy, parBuffer, rwhnf)
import Control.Parallel.Strategies (withStrategy, parBuffer, rseq)
import Data.Array
import Data.Char(chr)
......@@ -38,9 +38,9 @@ render (m,m') amb ls obj dep fov wid ht file
}
where
#ifdef STRATEGIES_2
parallel = parBuffer 100 rwhnf . map (\x -> seqList x `pseq` x)
parallel = parBuffer 100 rseq . map (\x -> seqList x `pseq` x)
#else
parallel = withStrategy (parBuffer 100 rwhnf) . map (\x -> seqList x `pseq` x)
parallel = withStrategy (parBuffer 100 rseq) . map (\x -> seqList x `pseq` x)
#endif
debugging = return ()
......
......@@ -135,7 +135,7 @@ parallelMandel mat limit radius
#ifdef STRATEGIES_2
parallel = parBuffer 70 rwhnf
#else
parallel = withStrategy (parBuffer 70 rwhnf)
parallel = withStrategy (parBuffer 70 rseq)
#endif
seqList :: [a] -> ()
......
-- Time-stamp: <2010-02-12 14:57:09 simonmar>
-- Time-stamp: <2011-10-07 11:36:17 simonmar>
-----------------------------------------------------------------------------
module Game where
......@@ -20,7 +20,7 @@ alternate _ _ _ _ b | static b == OWin = []
alternate depth player f g board = move : alternate depth opponent g f board'
where
move@(board',eval) = best f possibles scores
scores = map (bestMove depth opponent g f) possibles `using` parList rwhnf
scores = map (bestMove depth opponent g f) possibles `using` parList rseq
possibles = newPositions player board
opponent = opposite player
......@@ -62,4 +62,4 @@ mise f g (Branch _ l) = foldr f (g OWin XWin) (map (mise g f) l)
parMise :: Int -> Player -> Player -> (Tree Evaluation) -> Evaluation
parMise 0 f g t = mise f g t
parMise n f g (Branch a []) = a
parMise n f g (Branch _ l) = foldr f (g OWin XWin) (map (parMise (n-1) g f) l `using` parList rwhnf)
parMise n f g (Branch _ l) = foldr f (g OWin XWin) (map (parMise (n-1) g f) l `using` parList rseq)
......@@ -3,7 +3,7 @@ Michaelson for SML, converted to (parallel) Haskell by Kevin Hammond!
> {-# LANGUAGE BangPatterns,CPP #-}
> import Control.Parallel
> import Control.Parallel.Strategies (Strategy, withStrategy, rwhnf, parBuffer)
> import Control.Parallel.Strategies (Strategy, withStrategy, rseq, parBuffer)
> import System.Environment
> main = do
......@@ -144,7 +144,7 @@ in_poly_test (p,q,r) (A,B,C) Vs
#ifdef STRATEGIES_2
> parallel = parBuffer 200 rwhnf
#else
> parallel = withStrategy (parBuffer 200 rwhnf)
> parallel = withStrategy (parBuffer 200 rseq)
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment