I stuided the repa package today. I discover it supports parallel computation for both boxed type and unboxed type rather then only for unboxed type. It reminds me that I have to read the manual carefully.

Repa supports doing sum computation in parallel (see `sumP`

in repa doc). I just write a parallel sum function for fun.

import Data.Array.Repa as Repa import qualified Data.Vector.Unboxed as VU import Control.Monad.Identity sumR :: Int -> Double sumR n = let xs = VU.enumFromN 0 n in runIdentity (Repa.sumAllP (Repa.fromUnboxed (Z :. VU.length xs) xs)) main = putStrLn $ show . sumR $ 100000000

Tomorrow's goal: Accelerate package.

## Comments

Comments powered by Disqus