repa

Parallel mapM on Repa arrays

徘徊边缘 提交于 2019-12-02 21:32:00
In my recent work with Gibbs sampling , I've been making great use of the RVar which, in my view, provides a near ideal interface to random number generation. Sadly, I've been unable to make use of Repa due to the inability to use monadic actions in maps. While clearly monadic maps can't be parallelized in general, it seems to me that RVar may be at least one example of a monad where effects can be safely parallelized (at least in principle; I'm not terribly familiar with the inner workings of RVar ). Namely, I want to write something like the following, drawClass :: Sample -> RVar Class

'Repa' performance for planetary simulation

て烟熏妆下的殇ゞ 提交于 2019-12-02 17:23:33
I have written a simulation of the outer planets of the solar system using the Euler symplectic method and implemented this a) using repa and b) using yarr . yarr seems to perform about x30 quicker than repa . Given this, I didn't even try to use parallelism. Is there any obvious performance problems in my repa code? The repository is at github . I can produce a cut-down repa -only version if this is helpful, but then you won't get the performance comparison against yarr . Alternatively, how do I debug performance issues in repa ? Most Euler numeric integration methods suffer from cumulative

What are the key differences between the Repa 2 and 3 APIs?

泪湿孤枕 提交于 2019-11-30 07:01:37
To be more specific, I have the following innocuous-looking little Repa 3 program: {-# LANGUAGE QuasiQuotes #-} import Prelude hiding (map, zipWith) import System.Environment (getArgs) import Data.Word (Word8) import Data.Array.Repa import Data.Array.Repa.IO.DevIL import Data.Array.Repa.Stencil import Data.Array.Repa.Stencil.Dim2 main = do [s] <- getArgs img <- runIL $ readImage s let out = output x where RGB x = img runIL . writeImage "out.bmp" . Grey =<< computeP out output img = map cast . blur . blur $ blur grey where grey = traverse img to2D luminance cast n = floor n :: Word8 to2D (Z:.i:

Best way of “looping over a 2-D array”, using Repa

元气小坏坏 提交于 2019-11-29 20:48:48
I find the array library Repa for Haskell very interesting, and wanted to make a simple program, to try to understand how to use it. I also made a simple implementation using lists, which proved to be much faster. My main question is how I could improve the Repa code below to make it the most efficient (and hopefully also very readable). I am quite new using Haskell, and I couldn't find any easily understandable tutorial on Repa [ edit there is one at the Haskell Wiki , that I somehow forgot when I wrote this], so don't assume I know anything. :) For example, I'm not sure when to use force or

How to take an array slice with Repa over a range

梦想与她 提交于 2019-11-29 10:36:25
I am attempting to implement a cumulative sum function using Repa in order to calculate integral images. My current implementation looks like the following: cumsum :: (Elt a, Num a) => Array DIM2 a -> Array DIM2 a cumsum array = traverse array id cumsum' where elementSlice inner outer = slice array (inner :. (0 :: Int)) cumsum' f (inner :. outer) = Repa.sumAll $ elementSlice inner outer The problem is in the elementSlice function. In matlab or say numpy this could be specified as array[inner,0:outer]. So what I am looking for is something along the lines of: slice array (inner :. (Range 0

What are the key differences between the Repa 2 and 3 APIs?

天涯浪子 提交于 2019-11-29 08:18:22
问题 To be more specific, I have the following innocuous-looking little Repa 3 program: {-# LANGUAGE QuasiQuotes #-} import Prelude hiding (map, zipWith) import System.Environment (getArgs) import Data.Word (Word8) import Data.Array.Repa import Data.Array.Repa.IO.DevIL import Data.Array.Repa.Stencil import Data.Array.Repa.Stencil.Dim2 main = do [s] <- getArgs img <- runIL $ readImage s let out = output x where RGB x = img runIL . writeImage "out.bmp" . Grey =<< computeP out output img = map cast .

Best way of “looping over a 2-D array”, using Repa

安稳与你 提交于 2019-11-28 17:04:18
问题 I find the array library Repa for Haskell very interesting, and wanted to make a simple program, to try to understand how to use it. I also made a simple implementation using lists, which proved to be much faster. My main question is how I could improve the Repa code below to make it the most efficient (and hopefully also very readable). I am quite new using Haskell, and I couldn't find any easily understandable tutorial on Repa [ edit there is one at the Haskell Wiki, that I somehow forgot

How to take an array slice with Repa over a range

丶灬走出姿态 提交于 2019-11-28 03:34:44
问题 I am attempting to implement a cumulative sum function using Repa in order to calculate integral images. My current implementation looks like the following: cumsum :: (Elt a, Num a) => Array DIM2 a -> Array DIM2 a cumsum array = traverse array id cumsum' where elementSlice inner outer = slice array (inner :. (0 :: Int)) cumsum' f (inner :. outer) = Repa.sumAll $ elementSlice inner outer The problem is in the elementSlice function. In matlab or say numpy this could be specified as array[inner