summaryrefslogtreecommitdiff
path: root/examples/parallel.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/parallel.hs')
-rw-r--r--examples/parallel.hs28
1 files changed, 0 insertions, 28 deletions
diff --git a/examples/parallel.hs b/examples/parallel.hs
deleted file mode 100644
index 7256fb6..0000000
--- a/examples/parallel.hs
+++ /dev/null
@@ -1,28 +0,0 @@
1import System(getArgs)
2import Numeric.LinearAlgebra
3import Control.Parallel.Strategies
4import System.Time
5
6inParallel = parMap rwhnf id
7
8parMul x y = fromBlocks [inParallel[x <> y1, x <> y2]]
9 where p = cols y `div` 2
10 (y1,y2) = splitColumnsAt p y
11
12main = do
13 n <- (read . head) `fmap` getArgs
14 let m = ident n :: Matrix Double
15 time $ print $ vectorMax $ takeDiag $ parMul m m
16 time $ print $ vectorMax $ takeDiag $ m <> m
17
18a = (2><3) [1..6::Double]
19b = (3><4) [1..12::Double]
20
21splitRowsAt p m = (takeRows p m, dropRows p m)
22splitColumnsAt p m = (takeColumns p m, dropColumns p m)
23
24time act = do
25 t0 <- getClockTime
26 act
27 t1 <- getClockTime
28 print $ tdSec $ normalizeTimeDiff $ diffClockTimes t1 t0