packages feed

parconc-examples 0.1 → 0.2

raw patch · 3 files changed

+84/−18 lines, 3 filesdep ~binarynew-component:exe:rpar

Dependency ranges changed: binary

Files

mandel/mandel.hs view
@@ -101,16 +101,16 @@ -- >>  --- <<iter0+-- <<iter iter :: Exp Complex -> Exp (Complex,Int) -> Exp (Complex,Int) iter c p =   let-     (z,i) = unlift p :: (Exp Complex, Exp Int)-     z' = next c z+     (z,i) = unlift p :: (Exp Complex, Exp Int)    -- <1>+     z' = next c z                                 -- <2>   in-  (dot z' >* 4.0) ?-     ( p-     , lift (z', i+1)+  (dot z' >* 4.0) ?                                -- <3>+     ( p                                           -- <4>+     , lift (z', i+1)                              -- <5>      ) -- >> 
parconc-examples.cabal view
@@ -1,5 +1,5 @@ name:                parconc-examples-version:             0.1+version:             0.2 synopsis:            Examples to accompany the book "Parallel and Concurrent Programming in Haskell" -- description:          license:             BSD3@@ -36,6 +36,13 @@ -- ----------------------------------------------------------------------------- -- par-eval +executable rpar+  main-is: rpar.hs+  build-depends:   base >= 4.5 && < 4.7+                 , time ==1.4.*+                 , parallel ==3.2.*+  default-language: Haskell2010+ executable sudoku1   main-is: sudoku1.hs   other-modules: Sudoku@@ -135,7 +142,7 @@                  , monad-par >= 0.3.4 && < 0.4                    -- monad-par 0.3 has a bug:                    -- https://github.com/simonmar/monad-par/issues/23-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , array ==0.4.*                  , bytestring >= 0.9 && < 0.11                  , vector >= 0.10 && < 0.11@@ -146,7 +153,7 @@   hs-source-dirs: kmeans   main-is: GenSamples.hs   build-depends:   base >= 4.5 && < 4.7-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , array ==0.4.*                  , vector >= 0.10 && < 0.11                  , random >= 1.0 && < 1.1@@ -657,7 +664,7 @@   other-modules: DistribUtils   build-depends:   base >= 4.5 && < 4.7                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -672,7 +679,7 @@   other-modules: DistribUtils   build-depends:   base >= 4.5 && < 4.7                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -687,7 +694,7 @@   other-modules: DistribUtils   build-depends:   base >= 4.5 && < 4.7                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -702,7 +709,7 @@   other-modules: DistribUtils   build-depends:   base >= 4.5 && < 4.7                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -718,7 +725,7 @@   other-modules: DistribUtils   build-depends:   base >= 4.5 && < 4.7                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -732,7 +739,7 @@   main-is: distrib-ping/ping-fail.hs   build-depends:   base >= 4.5 && < 4.7                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -750,7 +757,7 @@                  , stm ==2.4.*                  , async ==2.0.*                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -769,7 +776,7 @@                  , stm ==2.4.*                  , async ==2.0.*                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*@@ -789,7 +796,7 @@                  , stm ==2.4.*                  , async ==2.0.*                  , network >= 2.3 && < 2.5-                 , binary >= 0.5 && < 0.7+                 , binary >=0.6.3 && < 0.7                  , distributed-process >= 0.4.2 && < 0.5                  , distributed-process-simplelocalnet ==0.2.*                  , distributed-static ==0.2.*
+ rpar.hs view
@@ -0,0 +1,59 @@+import Control.Parallel+import Control.Parallel.Strategies+import Control.Exception+import Data.Time.Clock+import Text.Printf+import System.Environment++-- <<fib+fib :: Integer -> Integer+fib 0 = 1+fib 1 = 1+fib n = fib (n-1) + fib (n-2)+-- >>++-- <<main+main = do+  [n] <- getArgs+  let test = [test1,test2,test3,test4] !! (read n - 1)+  t0 <- getCurrentTime+  r <- evaluate (runEval test)+  printTimeSince t0+  print r+  printTimeSince t0+-- >>++-- <<test1+test1 = do+  x <- rpar (fib 36)+  y <- rpar (fib 35)+  return (x,y)+-- >>++-- <<test2+test2 = do+  x <- rpar (fib 36)+  y <- rseq (fib 35)+  return (x,y)+-- >>++-- <<test3+test3 = do+  x <- rpar (fib 36)+  y <- rseq (fib 35)+  rseq x+  return (x,y)+-- >>++-- <<test4+test4 = do+  x <- rpar (fib 36)+  y <- rpar (fib 35)+  rseq x+  rseq y+  return (x,y)+-- >>++printTimeSince t0 = do+  t1 <- getCurrentTime+  printf "time: %.2fs\n" (realToFrac (diffUTCTime t1 t0) :: Double)