summaryrefslogtreecommitdiff
path: root/examples/parallel.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2009-10-15 10:13:24 +0000
committerAlberto Ruiz <aruiz@um.es>2009-10-15 10:13:24 +0000
commit4863cdb1a7495547f05e068f3f8228dae4e57f1f (patch)
tree6ceefcebc1916250909a49931bfb22705bc7fbcb /examples/parallel.hs
parent026f20453ff3c8981ef6cab2d5d865837977b78d (diff)
NFData instances
Diffstat (limited to 'examples/parallel.hs')
-rw-r--r--examples/parallel.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/parallel.hs b/examples/parallel.hs
index dfbfd88..8653bc3 100644
--- a/examples/parallel.hs
+++ b/examples/parallel.hs
@@ -1,14 +1,17 @@
1-- $ runhaskell parallel.hs 2000
2
1import System(getArgs) 3import System(getArgs)
2import Numeric.LinearAlgebra 4import Numeric.LinearAlgebra
3import Control.Parallel.Strategies 5import Control.Parallel.Strategies
4import System.Time 6import System.Time
5 7
6inParallel = parMap rwhnf id 8inParallel = parMap rnf id
9-- rwhnf also works in this case
7 10
11-- matrix product decomposed into p parallel subtasks
8parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ] 12parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ]
9 where ys = splitColumns p y 13 where ys = splitColumns p y
10 14
11
12main = do 15main = do
13 n <- (read . head) `fmap` getArgs 16 n <- (read . head) `fmap` getArgs
14 let m = ident n :: Matrix Double 17 let m = ident n :: Matrix Double